ome-xml  5.6.0
UnitsTime.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_UNITSTIME_H
47 #define OME_XML_MODEL_ENUMS_UNITSTIME_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 UnitsTime enumeration.
60 #define OME_XML_MODEL_ENUMS_UNITSTIME_VALUES (YOTTASECOND)(ZETTASECOND)(EXASECOND)(PETASECOND)(TERASECOND)(GIGASECOND)(MEGASECOND)(KILOSECOND)(HECTOSECOND)(DECASECOND)(SECOND)(DECISECOND)(CENTISECOND)(MILLISECOND)(MICROSECOND)(NANOSECOND)(PICOSECOND)(FEMTOSECOND)(ATTOSECOND)(ZEPTOSECOND)(YOCTOSECOND)(MINUTE)(HOUR)(DAY)
61 
62 namespace ome
63 {
64  namespace xml
65  {
66  namespace model
67  {
68  namespace enums
69  {
70 
74  class UnitsTime
75  {
76  public:
79  {
176  };
177 
184 
199  UnitsTime (const std::string& name, bool strict = true);
200 
206  UnitsTime (const UnitsTime& original);
207 
214  inline UnitsTime&
215  operator= (const UnitsTime& rhs)
216  {
217  this->value = rhs.value;
218  this->name = rhs.name;
219  return *this;
220  }
221 
227  inline
228  operator enum_value () const
229  {
230  return this->value;
231  }
232 
238  inline
239  operator const std::string& () const
240  {
241  return *this->name;
242  }
243 
245  typedef std::map<std::string, UnitsTime::enum_value> string_map_type;
247  typedef std::map<UnitsTime::enum_value, std::string> value_map_type;
248 
254  static const string_map_type&
255  strings();
256 
262  static const value_map_type&
263  values();
264 
265  private:
271  static const string_map_type&
273 
277  const std::string *name;
278  };
279 
287  inline bool
288  operator== (const UnitsTime& lhs,
289  const UnitsTime& rhs)
290  {
291  return static_cast<UnitsTime::enum_value>(lhs) == static_cast<UnitsTime::enum_value>(rhs);
292  }
293 
301  inline bool
302  operator== (const UnitsTime& lhs,
303  const UnitsTime::enum_value& rhs)
304  {
305  return static_cast<UnitsTime::enum_value>(lhs) == rhs;
306  }
307 
315  inline bool
317  const UnitsTime& rhs)
318  {
319  return lhs == static_cast<UnitsTime::enum_value>(rhs);
320  }
321 
329  inline bool
330  operator== (const UnitsTime& lhs,
331  const std::string& rhs)
332  {
333  return static_cast<const std::string&>(lhs) == rhs;
334  }
335 
343  inline bool
344  operator== (const std::string& lhs,
345  const UnitsTime& rhs)
346  {
347  return lhs == static_cast<const std::string&>(rhs);
348  }
349 
357  inline bool
358  operator!= (const UnitsTime& lhs,
359  const UnitsTime& rhs)
360  {
361  return static_cast<UnitsTime::enum_value>(lhs) != static_cast<UnitsTime::enum_value>(rhs);
362  }
363 
371  inline bool
372  operator!= (const UnitsTime& lhs,
373  const UnitsTime::enum_value& rhs)
374  {
375  return static_cast<UnitsTime::enum_value>(lhs) != rhs;
376  }
377 
385  inline bool
387  const UnitsTime& rhs)
388  {
389  return lhs != static_cast<UnitsTime::enum_value>(rhs);
390  }
391 
399  inline bool
400  operator!= (const UnitsTime& lhs,
401  const std::string& rhs)
402  {
403  return static_cast<const std::string&>(lhs) != rhs;
404  }
405 
413  inline bool
414  operator!= (const std::string& lhs,
415  const UnitsTime& rhs)
416  {
417  return lhs != static_cast<const std::string&>(rhs);
418  }
419 
427  template<class charT, class traits>
428  inline std::basic_ostream<charT,traits>&
429  operator<< (std::basic_ostream<charT,traits>& os,
430  const UnitsTime& enumeration)
431  {
432  return os << static_cast<const std::string&>(enumeration);
433  }
434 
442  template<class charT, class traits>
443  inline std::basic_istream<charT,traits>&
444  operator>> (std::basic_istream<charT,traits>& is,
445  UnitsTime& enumeration)
446  {
447  std::string value;
448  is >> value;
449  if (is)
450  {
451  try
452  {
453  enumeration = UnitsTime(value, false);
454  }
455  catch (const EnumerationException&)
456  {
457  is.setstate(std::ios::failbit);
458  }
459  }
460 
461  return is;
462  }
463 
464  }
465  }
466  }
467 }
468 
469 #include <ome/xml/model/enums/UnitsTimeConvert.h>
470 
471 #endif // OME_XML_MODEL_ENUMS_UNITSTIME_H
472 
473 /*
474  * Local Variables:
475  * mode:C++
476  * End:
477  */
hour SI-derived unit.
Definition: UnitsTime.h:171
std::basic_istream< charT, traits > & operator>>(std::basic_istream< charT, traits > &is, AcquisitionMode &enumeration)
Set AcquisitionMode from input stream.
Definition: AcquisitionMode.h:392
bool operator!=(const AcquisitionMode &lhs, const AcquisitionMode &rhs)
Compare two AcquisitionMode objects for non-equality.
Definition: AcquisitionMode.h:306
hectosecond SI unit.
Definition: UnitsTime.h:115
centisecond SI unit.
Definition: UnitsTime.h:131
nanosecond SI unit.
Definition: UnitsTime.h:143
yottasecond SI unit.
Definition: UnitsTime.h:83
EnumerationException is thrown when an enumeration is invalid or not found.
Definition: EnumerationException.h:74
petasecond SI unit.
Definition: UnitsTime.h:95
zeptosecond SI unit.
Definition: UnitsTime.h:159
UnitsTime(enum_value value)
Construct a UnitsTime enumeration by an enumeration value.
Definition: UnitsTime.cpp:67
yoctosecond SI unit.
Definition: UnitsTime.h:163
minute SI-derived unit.
Definition: UnitsTime.h:167
picosecond SI unit.
Definition: UnitsTime.h:147
femtosecond SI unit.
Definition: UnitsTime.h:151
terasecond SI unit.
Definition: UnitsTime.h:99
Open Microscopy Environment C++ implementation.
gigasecond SI unit.
Definition: UnitsTime.h:103
decasecond SI unit.
Definition: UnitsTime.h:119
megasecond SI unit.
Definition: UnitsTime.h:107
decisecond SI unit.
Definition: UnitsTime.h:127
std::map< UnitsTime::enum_value, std::string > value_map_type
Value map type.
Definition: UnitsTime.h:247
millisecond SI unit.
Definition: UnitsTime.h:135
bool operator==(const AcquisitionMode &lhs, const AcquisitionMode &rhs)
Compare two AcquisitionMode objects for equality.
Definition: AcquisitionMode.h:236
UnitsTime & operator=(const UnitsTime &rhs)
Assignment operator.
Definition: UnitsTime.h:215
enum_value value
Enumeration value.
Definition: UnitsTime.h:275
zettasecond SI unit.
Definition: UnitsTime.h:87
static const string_map_type & lowercase_strings()
Get a map of valid lowercased string names and enum values.
Definition: UnitsTime.cpp:198
second SI unit.
Definition: UnitsTime.h:123
UnitsTime enumeration.
Definition: UnitsTime.h:74
microsecond SI unit.
Definition: UnitsTime.h:139
exasecond SI unit.
Definition: UnitsTime.h:91
kilosecond SI unit.
Definition: UnitsTime.h:111
static const value_map_type & values()
Get a map of valid enum values and string names.
Definition: UnitsTime.cpp:164
attosecond SI unit.
Definition: UnitsTime.h:155
day SI-derived unit.
Definition: UnitsTime.h:175
std::map< std::string, UnitsTime::enum_value > string_map_type
String map type.
Definition: UnitsTime.h:245
const std::string * name
Enumeration name.
Definition: UnitsTime.h:277
enum_value
Enumeration values.
Definition: UnitsTime.h:78
static const string_map_type & strings()
Get a map of valid string names and enum values.
Definition: UnitsTime.cpp:130