ome-xml 5.2.3

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:
78 enum enum_value
79 {
83 YOTTASECOND,
87 ZETTASECOND,
91 EXASECOND,
95 PETASECOND,
99 TERASECOND,
103 GIGASECOND,
107 MEGASECOND,
111 KILOSECOND,
115 HECTOSECOND,
119 DECASECOND,
123 SECOND,
127 DECISECOND,
131 CENTISECOND,
135 MILLISECOND,
139 MICROSECOND,
143 NANOSECOND,
147 PICOSECOND,
151 FEMTOSECOND,
155 ATTOSECOND,
159 ZEPTOSECOND,
163 YOCTOSECOND,
167 MINUTE,
171 HOUR,
175 DAY
176 };
177
183 UnitsTime (enum_value value);
184
199 UnitsTime (const std::string& name, bool strict = true);
200
206 UnitsTime (const UnitsTime& original);
207
212 inline UnitsTime&
213 operator= (const UnitsTime& rhs)
214 {
215 this->value = rhs.value;
216 this->name = rhs.name;
217 return *this;
218 }
219
225 inline
226 operator enum_value () const
227 {
228 return this->value;
229 }
230
236 inline
237 operator const std::string& () const
238 {
239 return *this->name;
240 }
241
243 typedef std::map<std::string, UnitsTime::enum_value> string_map_type;
245 typedef std::map<UnitsTime::enum_value, std::string> value_map_type;
246
252 static const string_map_type&
253 strings();
254
260 static const value_map_type&
261 values();
262
263 private:
269 static const string_map_type&
270 lowercase_strings();
271
273 enum_value value;
275 const std::string *name;
276 };
277
285 inline bool
286 operator== (const UnitsTime& lhs,
287 const UnitsTime& rhs)
288 {
289 return static_cast<UnitsTime::enum_value>(lhs) == static_cast<UnitsTime::enum_value>(rhs);
290 }
291
299 inline bool
300 operator== (const UnitsTime& lhs,
301 const UnitsTime::enum_value& rhs)
302 {
303 return static_cast<UnitsTime::enum_value>(lhs) == rhs;
304 }
305
313 inline bool
314 operator== (const UnitsTime::enum_value& lhs,
315 const UnitsTime& rhs)
316 {
317 return lhs == static_cast<UnitsTime::enum_value>(rhs);
318 }
319
327 inline bool
328 operator== (const UnitsTime& lhs,
329 const std::string& rhs)
330 {
331 return static_cast<const std::string&>(lhs) == rhs;
332 }
333
341 inline bool
342 operator== (const std::string& lhs,
343 const UnitsTime& rhs)
344 {
345 return lhs == static_cast<const std::string&>(rhs);
346 }
347
355 inline bool
356 operator!= (const UnitsTime& lhs,
357 const UnitsTime& rhs)
358 {
359 return static_cast<UnitsTime::enum_value>(lhs) != static_cast<UnitsTime::enum_value>(rhs);
360 }
361
369 inline bool
370 operator!= (const UnitsTime& lhs,
371 const UnitsTime::enum_value& rhs)
372 {
373 return static_cast<UnitsTime::enum_value>(lhs) != rhs;
374 }
375
383 inline bool
384 operator!= (const UnitsTime::enum_value& lhs,
385 const UnitsTime& rhs)
386 {
387 return lhs != static_cast<UnitsTime::enum_value>(rhs);
388 }
389
397 inline bool
398 operator!= (const UnitsTime& lhs,
399 const std::string& rhs)
400 {
401 return static_cast<const std::string&>(lhs) != rhs;
402 }
403
411 inline bool
412 operator!= (const std::string& lhs,
413 const UnitsTime& rhs)
414 {
415 return lhs != static_cast<const std::string&>(rhs);
416 }
417
425 template<class charT, class traits>
426 inline std::basic_ostream<charT,traits>&
427 operator<< (std::basic_ostream<charT,traits>& os,
428 const UnitsTime& enumeration)
429 {
430 return os << static_cast<const std::string&>(enumeration);
431 }
432
440 template<class charT, class traits>
441 inline std::basic_istream<charT,traits>&
442 operator>> (std::basic_istream<charT,traits>& is,
443 UnitsTime& enumeration)
444 {
445 std::string value;
446 is >> value;
447 if (is)
448 {
449 try
450 {
451 enumeration = UnitsTime(value, false);
452 }
453 catch (const EnumerationException&)
454 {
455 is.setstate(std::ios::failbit);
456 }
457 }
458
459 return is;
460 }
461
462 }
463 }
464 }
465 }
466
467 #include <ome/xml/model/enums/UnitsTimeConvert.h>
468
469 #endif // OME_XML_MODEL_ENUMS_UNITSTIME_H
470
471 /*
472 * Local Variables:
473 * mode:C++
474 * End:
475 */
ome::xml::model::enums::UnitsTime::HOUR
hour SI-derived unit.
Definition: UnitsTime.h:171
ome::xml::model::enums::operator>>
std::basic_istream< charT, traits > & operator>>(std::basic_istream< charT, traits > &is, AcquisitionMode &enumeration)
Set AcquisitionMode from input stream.
Definition: AcquisitionMode.h:390
ome::xml::model::enums::operator!=
bool operator!=(const AcquisitionMode &lhs, const AcquisitionMode &rhs)
Compare two AcquisitionMode objects for non-equality.
Definition: AcquisitionMode.h:304
ome::xml::model::enums::UnitsTime::HECTOSECOND
hectosecond SI unit.
Definition: UnitsTime.h:115
ome::xml::model::enums::UnitsTime::CENTISECOND
centisecond SI unit.
Definition: UnitsTime.h:131
ome::xml::model::enums::UnitsTime::NANOSECOND
nanosecond SI unit.
Definition: UnitsTime.h:143
ome::xml::model::enums::UnitsTime::YOTTASECOND
yottasecond SI unit.
Definition: UnitsTime.h:83
ome::xml::model::enums::EnumerationException
EnumerationException is thrown when an enumeration is invalid or not found.
Definition: EnumerationException.h:74
ome::xml::model::enums::UnitsTime::PETASECOND
petasecond SI unit.
Definition: UnitsTime.h:95
ome::xml::model::enums::UnitsTime::ZEPTOSECOND
zeptosecond SI unit.
Definition: UnitsTime.h:159
ome::xml::model::enums::UnitsTime::UnitsTime
UnitsTime(enum_value value)
Construct a UnitsTime enumeration by an enumeration value.
Definition: UnitsTime.cpp:75
ome::xml::model::enums::UnitsTime::YOCTOSECOND
yoctosecond SI unit.
Definition: UnitsTime.h:163
ome::xml::model::enums::UnitsTime::MINUTE
minute SI-derived unit.
Definition: UnitsTime.h:167
ome::xml::model::enums::UnitsTime::PICOSECOND
picosecond SI unit.
Definition: UnitsTime.h:147
ome::xml::model::enums::UnitsTime::FEMTOSECOND
femtosecond SI unit.
Definition: UnitsTime.h:151
ome::xml::model::enums::UnitsTime::TERASECOND
terasecond SI unit.
Definition: UnitsTime.h:99
ome
Open Microscopy Environment C++ implementation.
ome::xml::model::enums::UnitsTime::GIGASECOND
gigasecond SI unit.
Definition: UnitsTime.h:103
ome::xml::model::enums::UnitsTime::DECASECOND
decasecond SI unit.
Definition: UnitsTime.h:119
ome::xml::model::enums::UnitsTime::MEGASECOND
megasecond SI unit.
Definition: UnitsTime.h:107
ome::xml::model::enums::UnitsTime::DECISECOND
decisecond SI unit.
Definition: UnitsTime.h:127
ome::xml::model::enums::UnitsTime::value_map_type
std::map< UnitsTime::enum_value, std::string > value_map_type
Value map type.
Definition: UnitsTime.h:245
ome::xml::model::enums::UnitsTime::MILLISECOND
millisecond SI unit.
Definition: UnitsTime.h:135
ome::xml::model::enums::operator==
bool operator==(const AcquisitionMode &lhs, const AcquisitionMode &rhs)
Compare two AcquisitionMode objects for equality.
Definition: AcquisitionMode.h:234
ome::xml::model::enums::UnitsTime::operator=
UnitsTime & operator=(const UnitsTime &rhs)
Assignment operator.
Definition: UnitsTime.h:213
ome::xml::model::enums::UnitsTime::value
enum_value value
Enumeration value.
Definition: UnitsTime.h:273
ome::xml::model::enums::UnitsTime::ZETTASECOND
zettasecond SI unit.
Definition: UnitsTime.h:87
ome::xml::model::enums::UnitsTime::lowercase_strings
static const string_map_type & lowercase_strings()
Get a map of valid lowercased string names and enum values.
Definition: UnitsTime.cpp:212
ome::xml::model::enums::UnitsTime::SECOND
second SI unit.
Definition: UnitsTime.h:123
ome::xml::model::enums::UnitsTime
UnitsTime enumeration.
Definition: UnitsTime.h:74
ome::xml::model::enums::UnitsTime::MICROSECOND
microsecond SI unit.
Definition: UnitsTime.h:139
ome::xml::model::enums::UnitsTime::EXASECOND
exasecond SI unit.
Definition: UnitsTime.h:91
ome::xml::model::enums::UnitsTime::KILOSECOND
kilosecond SI unit.
Definition: UnitsTime.h:111
ome::xml::model::enums::UnitsTime::values
static const value_map_type & values()
Get a map of valid enum values and string names.
Definition: UnitsTime.cpp:175
ome::xml::model::enums::UnitsTime::ATTOSECOND
attosecond SI unit.
Definition: UnitsTime.h:155
ome::xml::model::enums::UnitsTime::DAY
day SI-derived unit.
Definition: UnitsTime.h:175
ome::xml::model::enums::UnitsTime::string_map_type
std::map< std::string, UnitsTime::enum_value > string_map_type
String map type.
Definition: UnitsTime.h:243
log.h
ome::xml::model::enums::UnitsTime::name
const std::string * name
Enumeration name.
Definition: UnitsTime.h:275
ome::xml::model::enums::UnitsTime::enum_value
enum_value
Enumeration values.
Definition: UnitsTime.h:78
ome::xml::model::enums::UnitsTime::strings
static const string_map_type & strings()
Get a map of valid string names and enum values.
Definition: UnitsTime.cpp:138