ome-xml  5.6.0
TimeQuantity.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_TIMEQUANTITY_H
47 #define OME_XML_MODEL_PRIMITIVES_TIMEQUANTITY_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 
68  class UnitsTime
69  {
70  public:
73  {
122  };
123 
130 
145  UnitsTime (const std::string& name, bool strict = true);
146 
152  UnitsTime (const UnitsTime& original);
153 
160  inline UnitsTime&
161  operator= (const UnitsTime& rhs)
162  {
163  this->value = rhs.value;
164  this->name = rhs.name;
165  return *this;
166  }
167 
173  inline
174  operator enum_value () const
175  {
176  return this->value;
177  }
178 
184  inline
185  operator const std::string& () const
186  {
187  return *this->name;
188  }
189 
191  typedef std::map<std::string, UnitsTime::enum_value> string_map_type;
193  typedef std::map<UnitsTime::enum_value, std::string> value_map_type;
194 
200  static const string_map_type&
201  strings();
202 
208  static const value_map_type&
209  values();
210 
211  private:
217  static const string_map_type&
219 
223  const std::string *name;
224  };
225 
233  inline bool
234  operator== (const UnitsTime& lhs,
235  const UnitsTime& rhs)
236  {
237  return static_cast<UnitsTime::enum_value>(lhs) == static_cast<UnitsTime::enum_value>(rhs);
238  }
239 
247  inline bool
248  operator== (const UnitsTime& lhs,
249  const UnitsTime::enum_value& rhs)
250  {
251  return static_cast<UnitsTime::enum_value>(lhs) == rhs;
252  }
253 
261  inline bool
263  const UnitsTime& rhs)
264  {
265  return lhs == static_cast<UnitsTime::enum_value>(rhs);
266  }
267 
275  inline bool
276  operator== (const UnitsTime& lhs,
277  const std::string& rhs)
278  {
279  return static_cast<const std::string&>(lhs) == rhs;
280  }
281 
289  inline bool
290  operator== (const std::string& lhs,
291  const UnitsTime& rhs)
292  {
293  return lhs == static_cast<const std::string&>(rhs);
294  }
295 
303  inline bool
304  operator!= (const UnitsTime& lhs,
305  const UnitsTime& rhs)
306  {
307  return static_cast<UnitsTime::enum_value>(lhs) != static_cast<UnitsTime::enum_value>(rhs);
308  }
309 
317  inline bool
318  operator!= (const UnitsTime& lhs,
319  const UnitsTime::enum_value& rhs)
320  {
321  return static_cast<UnitsTime::enum_value>(lhs) != rhs;
322  }
323 
331  inline bool
333  const UnitsTime& rhs)
334  {
335  return lhs != static_cast<UnitsTime::enum_value>(rhs);
336  }
337 
345  inline bool
346  operator!= (const UnitsTime& lhs,
347  const std::string& rhs)
348  {
349  return static_cast<const std::string&>(lhs) != rhs;
350  }
351 
359  inline bool
360  operator!= (const std::string& lhs,
361  const UnitsTime& rhs)
362  {
363  return lhs != static_cast<const std::string&>(rhs);
364  }
365 
373  template<class charT, class traits>
374  inline std::basic_ostream<charT,traits>&
375  operator<< (std::basic_ostream<charT,traits>& os,
376  const UnitsTime& enumeration)
377  {
378  return os << static_cast<const std::string&>(enumeration);
379  }
380 
388  template<class charT, class traits>
389  inline std::basic_istream<charT,traits>&
390  operator>> (std::basic_istream<charT,traits>& is,
391  UnitsTime& enumeration)
392  {
393  std::string value;
394  is >> value;
395  if (is)
396  {
397  try
398  {
399  enumeration = UnitsTime(value, false);
400  }
401  catch (const EnumerationException&)
402  {
403  is.setstate(std::ios::failbit);
404  }
405  }
406 
407  return is;
408  }
409 
410  }
411  }
412  }
413 }
414 
415 #endif // OME_XML_MODEL_PRIMITIVES_TIMEQUANTITY_H
416 
417 /*
418  * Local Variables:
419  * mode:C++
420  * End:
421  */
exasecond SI unit.
Definition: TimeQuantity.h:79
megasecond SI unit.
Definition: TimeQuantity.h:87
decisecond SI unit.
Definition: TimeQuantity.h:97
microsecond SI unit.
Definition: TimeQuantity.h:103
zettasecond SI unit.
Definition: TimeQuantity.h:77
hectosecond SI unit.
Definition: TimeQuantity.h:91
bool operator!=(const Color &lhs, const Color &rhs)
Compare two Color objects for non-equality.
Definition: Color.h:392
static const string_map_type & lowercase_strings()
Get a map of valid lowercased string names and enum values.
enum_value
Enumeration values.
Definition: TimeQuantity.h:72
static const string_map_type & strings()
Get a map of valid string names and enum values.
zeptosecond SI unit.
Definition: TimeQuantity.h:113
UnitsTime(enum_value value)
Construct a UnitsTime quantity by an enumeration value.
std::map< UnitsTime::enum_value, std::string > value_map_type
Value map type.
Definition: TimeQuantity.h:193
terasecond SI unit.
Definition: TimeQuantity.h:83
nanosecond SI unit.
Definition: TimeQuantity.h:105
yottasecond SI unit.
Definition: TimeQuantity.h:75
day SI-derived unit.
Definition: TimeQuantity.h:121
UnitsTime & operator=(const UnitsTime &rhs)
Assignment operator.
Definition: TimeQuantity.h:161
kilosecond SI unit.
Definition: TimeQuantity.h:89
Open Microscopy Environment C++ implementation.
bool operator==(const Color &lhs, const Color &rhs)
Compare two Color objects for equality.
Definition: Color.h:322
minute SI-derived unit.
Definition: TimeQuantity.h:117
const std::string * name
Enumeration name.
Definition: TimeQuantity.h:223
petasecond SI unit.
Definition: TimeQuantity.h:81
std::map< std::string, UnitsTime::enum_value > string_map_type
String map type.
Definition: TimeQuantity.h:191
std::basic_istream< charT, traits > & operator>>(std::basic_istream< charT, traits > &is, Color &color)
Set Color from input stream.
Definition: Color.h:478
attosecond SI unit.
Definition: TimeQuantity.h:111
femtosecond SI unit.
Definition: TimeQuantity.h:109
hour SI-derived unit.
Definition: TimeQuantity.h:119
UnitsTime enumeration.
Definition: TimeQuantity.h:68
millisecond SI unit.
Definition: TimeQuantity.h:101
centisecond SI unit.
Definition: TimeQuantity.h:99
second SI unit.
Definition: TimeQuantity.h:95
gigasecond SI unit.
Definition: TimeQuantity.h:85
decasecond SI unit.
Definition: TimeQuantity.h:93
yoctosecond SI unit.
Definition: TimeQuantity.h:115
picosecond SI unit.
Definition: TimeQuantity.h:107
static const value_map_type & values()
Get a map of valid enum values and string names.
enum_value value
Enumeration value.
Definition: TimeQuantity.h:221