ome-xml 5.2.3

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:
72 enum enum_value
73 {
75 YOTTASECOND,
77 ZETTASECOND,
79 EXASECOND,
81 PETASECOND,
83 TERASECOND,
85 GIGASECOND,
87 MEGASECOND,
89 KILOSECOND,
91 HECTOSECOND,
93 DECASECOND,
95 SECOND,
97 DECISECOND,
99 CENTISECOND,
101 MILLISECOND,
103 MICROSECOND,
105 NANOSECOND,
107 PICOSECOND,
109 FEMTOSECOND,
111 ATTOSECOND,
113 ZEPTOSECOND,
115 YOCTOSECOND,
117 MINUTE,
119 HOUR,
121 DAY
122 };
123
129 UnitsTime (enum_value value);
130
145 UnitsTime (const std::string& name, bool strict = true);
146
152 UnitsTime (const UnitsTime& original);
153
158 inline UnitsTime&
159 operator= (const UnitsTime& rhs)
160 {
161 this->value = rhs.value;
162 this->name = rhs.name;
163 return *this;
164 }
165
171 inline
172 operator enum_value () const
173 {
174 return this->value;
175 }
176
182 inline
183 operator const std::string& () const
184 {
185 return *this->name;
186 }
187
189 typedef std::map<std::string, UnitsTime::enum_value> string_map_type;
191 typedef std::map<UnitsTime::enum_value, std::string> value_map_type;
192
198 static const string_map_type&
199 strings();
200
206 static const value_map_type&
207 values();
208
209 private:
215 static const string_map_type&
216 lowercase_strings();
217
219 enum_value value;
221 const std::string *name;
222 };
223
231 inline bool
232 operator== (const UnitsTime& lhs,
233 const UnitsTime& rhs)
234 {
235 return static_cast<UnitsTime::enum_value>(lhs) == static_cast<UnitsTime::enum_value>(rhs);
236 }
237
245 inline bool
246 operator== (const UnitsTime& lhs,
247 const UnitsTime::enum_value& rhs)
248 {
249 return static_cast<UnitsTime::enum_value>(lhs) == rhs;
250 }
251
259 inline bool
260 operator== (const UnitsTime::enum_value& lhs,
261 const UnitsTime& rhs)
262 {
263 return lhs == static_cast<UnitsTime::enum_value>(rhs);
264 }
265
273 inline bool
274 operator== (const UnitsTime& lhs,
275 const std::string& rhs)
276 {
277 return static_cast<const std::string&>(lhs) == rhs;
278 }
279
287 inline bool
288 operator== (const std::string& lhs,
289 const UnitsTime& rhs)
290 {
291 return lhs == static_cast<const std::string&>(rhs);
292 }
293
301 inline bool
302 operator!= (const UnitsTime& lhs,
303 const UnitsTime& rhs)
304 {
305 return static_cast<UnitsTime::enum_value>(lhs) != static_cast<UnitsTime::enum_value>(rhs);
306 }
307
315 inline bool
316 operator!= (const UnitsTime& lhs,
317 const UnitsTime::enum_value& rhs)
318 {
319 return static_cast<UnitsTime::enum_value>(lhs) != rhs;
320 }
321
329 inline bool
330 operator!= (const UnitsTime::enum_value& lhs,
331 const UnitsTime& rhs)
332 {
333 return lhs != static_cast<UnitsTime::enum_value>(rhs);
334 }
335
343 inline bool
344 operator!= (const UnitsTime& lhs,
345 const std::string& rhs)
346 {
347 return static_cast<const std::string&>(lhs) != rhs;
348 }
349
357 inline bool
358 operator!= (const std::string& lhs,
359 const UnitsTime& rhs)
360 {
361 return lhs != static_cast<const std::string&>(rhs);
362 }
363
371 template<class charT, class traits>
372 inline std::basic_ostream<charT,traits>&
373 operator<< (std::basic_ostream<charT,traits>& os,
374 const UnitsTime& enumeration)
375 {
376 return os << static_cast<const std::string&>(enumeration);
377 }
378
386 template<class charT, class traits>
387 inline std::basic_istream<charT,traits>&
388 operator>> (std::basic_istream<charT,traits>& is,
389 UnitsTime& enumeration)
390 {
391 std::string value;
392 is >> value;
393 if (is)
394 {
395 try
396 {
397 enumeration = UnitsTime(value, false);
398 }
399 catch (const EnumerationException&)
400 {
401 is.setstate(std::ios::failbit);
402 }
403 }
404
405 return is;
406 }
407
408 }
409 }
410 }
411 }
412
413 #endif // OME_XML_MODEL_PRIMITIVES_TIMEQUANTITY_H
414
415 /*
416 * Local Variables:
417 * mode:C++
418 * End:
419 */
ome::xml::model::primitives::UnitsTime::EXASECOND
exasecond SI unit.
Definition: TimeQuantity.h:79
ome::xml::model::primitives::UnitsTime::MEGASECOND
megasecond SI unit.
Definition: TimeQuantity.h:87
ome::xml::model::primitives::UnitsTime::DECISECOND
decisecond SI unit.
Definition: TimeQuantity.h:97
ome::xml::model::primitives::UnitsTime::MICROSECOND
microsecond SI unit.
Definition: TimeQuantity.h:103
ome::xml::model::primitives::UnitsTime::ZETTASECOND
zettasecond SI unit.
Definition: TimeQuantity.h:77
ome::xml::model::primitives::UnitsTime::HECTOSECOND
hectosecond SI unit.
Definition: TimeQuantity.h:91
ome::xml::model::primitives::operator!=
bool operator!=(const Color &lhs, const Color &rhs)
Compare two Color objects for non-equality.
Definition: Color.h:393
ome::xml::model::primitives::UnitsTime::lowercase_strings
static const string_map_type & lowercase_strings()
Get a map of valid lowercased string names and enum values.
ome::xml::model::primitives::UnitsTime::enum_value
enum_value
Enumeration values.
Definition: TimeQuantity.h:72
ome::xml::model::primitives::UnitsTime::strings
static const string_map_type & strings()
Get a map of valid string names and enum values.
ome::xml::model::primitives::UnitsTime::ZEPTOSECOND
zeptosecond SI unit.
Definition: TimeQuantity.h:113
ome::xml::model::primitives::UnitsTime::UnitsTime
UnitsTime(enum_value value)
Construct a UnitsTime quantity by an enumeration value.
ome::xml::model::primitives::UnitsTime::value_map_type
std::map< UnitsTime::enum_value, std::string > value_map_type
Value map type.
Definition: TimeQuantity.h:191
ome::xml::model::primitives::UnitsTime::TERASECOND
terasecond SI unit.
Definition: TimeQuantity.h:83
ome::xml::model::primitives::UnitsTime::NANOSECOND
nanosecond SI unit.
Definition: TimeQuantity.h:105
ome::xml::model::primitives::UnitsTime::YOTTASECOND
yottasecond SI unit.
Definition: TimeQuantity.h:75
ome::xml::model::primitives::UnitsTime::DAY
day SI-derived unit.
Definition: TimeQuantity.h:121
ome::xml::model::primitives::UnitsTime::operator=
UnitsTime & operator=(const UnitsTime &rhs)
Assignment operator.
Definition: TimeQuantity.h:159
ome::xml::model::primitives::UnitsTime::KILOSECOND
kilosecond SI unit.
Definition: TimeQuantity.h:89
ome
Open Microscopy Environment C++ implementation.
ome::xml::model::primitives::operator==
bool operator==(const Color &lhs, const Color &rhs)
Compare two Color objects for equality.
Definition: Color.h:323
ome::xml::model::primitives::UnitsTime::MINUTE
minute SI-derived unit.
Definition: TimeQuantity.h:117
ome::xml::model::primitives::UnitsTime::name
const std::string * name
Enumeration name.
Definition: TimeQuantity.h:221
ome::xml::model::primitives::UnitsTime::PETASECOND
petasecond SI unit.
Definition: TimeQuantity.h:81
ome::xml::model::primitives::UnitsTime::string_map_type
std::map< std::string, UnitsTime::enum_value > string_map_type
String map type.
Definition: TimeQuantity.h:189
ome::xml::model::primitives::operator>>
std::basic_istream< charT, traits > & operator>>(std::basic_istream< charT, traits > &is, Color &color)
Set Color from input stream.
Definition: Color.h:479
ome::xml::model::primitives::UnitsTime::ATTOSECOND
attosecond SI unit.
Definition: TimeQuantity.h:111
ome::xml::model::primitives::UnitsTime::FEMTOSECOND
femtosecond SI unit.
Definition: TimeQuantity.h:109
ome::xml::model::primitives::UnitsTime::HOUR
hour SI-derived unit.
Definition: TimeQuantity.h:119
ome::xml::model::primitives::UnitsTime
UnitsTime enumeration.
Definition: TimeQuantity.h:68
ome::xml::model::primitives::UnitsTime::MILLISECOND
millisecond SI unit.
Definition: TimeQuantity.h:101
ome::xml::model::primitives::UnitsTime::CENTISECOND
centisecond SI unit.
Definition: TimeQuantity.h:99
ome::xml::model::primitives::UnitsTime::SECOND
second SI unit.
Definition: TimeQuantity.h:95
ome::xml::model::primitives::UnitsTime::GIGASECOND
gigasecond SI unit.
Definition: TimeQuantity.h:85
ome::xml::model::primitives::UnitsTime::DECASECOND
decasecond SI unit.
Definition: TimeQuantity.h:93
ome::xml::model::primitives::UnitsTime::YOCTOSECOND
yoctosecond SI unit.
Definition: TimeQuantity.h:115
log.h
ome::xml::model::primitives::UnitsTime::PICOSECOND
picosecond SI unit.
Definition: TimeQuantity.h:107
ome::xml::model::primitives::UnitsTime::values
static const value_map_type & values()
Get a map of valid enum values and string names.
ome::xml::model::primitives::UnitsTime::value
enum_value value
Enumeration value.
Definition: TimeQuantity.h:219