ome-xml 5.2.3

PixelType.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_PIXELTYPE_H
47 #define OME_XML_MODEL_ENUMS_PIXELTYPE_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 // All values in the PixelType enumeration.
58 #define OME_XML_MODEL_ENUMS_PIXELTYPE_VALUES (INT8)(INT16)(INT32)(UINT8)(UINT16)(UINT32)(FLOAT)(DOUBLE)(COMPLEXFLOAT)(COMPLEXDOUBLE)(BIT)
59
60 namespace ome
61 {
62 namespace xml
63 {
64 namespace model
65 {
66 namespace enums
67 {
68
72 class PixelType
73 {
74 public:
76 enum enum_value
77 {
81 INT8,
85 INT16,
89 INT32,
93 UINT8,
97 UINT16,
101 UINT32,
105 FLOAT,
109 DOUBLE,
113 COMPLEXFLOAT,
117 COMPLEXDOUBLE,
121 BIT
122 };
123
129 PixelType (enum_value value);
130
145 PixelType (const std::string& name, bool strict = true);
146
152 PixelType (const PixelType& original);
153
158 inline PixelType&
159 operator= (const PixelType& 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, PixelType::enum_value> string_map_type;
191 typedef std::map<PixelType::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 PixelType& lhs,
233 const PixelType& rhs)
234 {
235 return static_cast<PixelType::enum_value>(lhs) == static_cast<PixelType::enum_value>(rhs);
236 }
237
245 inline bool
246 operator== (const PixelType& lhs,
247 const PixelType::enum_value& rhs)
248 {
249 return static_cast<PixelType::enum_value>(lhs) == rhs;
250 }
251
259 inline bool
260 operator== (const PixelType::enum_value& lhs,
261 const PixelType& rhs)
262 {
263 return lhs == static_cast<PixelType::enum_value>(rhs);
264 }
265
273 inline bool
274 operator== (const PixelType& 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 PixelType& rhs)
290 {
291 return lhs == static_cast<const std::string&>(rhs);
292 }
293
301 inline bool
302 operator!= (const PixelType& lhs,
303 const PixelType& rhs)
304 {
305 return static_cast<PixelType::enum_value>(lhs) != static_cast<PixelType::enum_value>(rhs);
306 }
307
315 inline bool
316 operator!= (const PixelType& lhs,
317 const PixelType::enum_value& rhs)
318 {
319 return static_cast<PixelType::enum_value>(lhs) != rhs;
320 }
321
329 inline bool
330 operator!= (const PixelType::enum_value& lhs,
331 const PixelType& rhs)
332 {
333 return lhs != static_cast<PixelType::enum_value>(rhs);
334 }
335
343 inline bool
344 operator!= (const PixelType& 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 PixelType& 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 PixelType& 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 PixelType& enumeration)
390 {
391 std::string value;
392 is >> value;
393 if (is)
394 {
395 try
396 {
397 enumeration = PixelType(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_ENUMS_PIXELTYPE_H
414
415 /*
416 * Local Variables:
417 * mode:C++
418 * End:
419 */
ome::xml::model::enums::PixelType::UINT32
32 bit unsigned integer.
Definition: PixelType.h:101
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::PixelType::UINT8
8 bit unsigned integer.
Definition: PixelType.h:93
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::PixelType::PixelType
PixelType(enum_value value)
Construct a PixelType enumeration by an enumeration value.
Definition: PixelType.cpp:75
ome::xml::model::enums::PixelType::BIT
bit mask.
Definition: PixelType.h:121
ome::xml::model::enums::EnumerationException
EnumerationException is thrown when an enumeration is invalid or not found.
Definition: EnumerationException.h:74
ome::xml::model::enums::PixelType::INT8
8 bit signed integer.
Definition: PixelType.h:81
ome::xml::model::enums::PixelType::lowercase_strings
static const string_map_type & lowercase_strings()
Get a map of valid lowercased string names and enum values.
Definition: PixelType.cpp:186
ome::xml::model::enums::PixelType::string_map_type
std::map< std::string, PixelType::enum_value > string_map_type
String map type.
Definition: PixelType.h:189
ome::xml::model::enums::PixelType::values
static const value_map_type & values()
Get a map of valid enum values and string names.
Definition: PixelType.cpp:162
ome::xml::model::enums::PixelType::enum_value
enum_value
Enumeration values.
Definition: PixelType.h:76
ome::xml::model::enums::PixelType::INT16
16 bit signed integer.
Definition: PixelType.h:85
ome::xml::model::enums::PixelType::UINT16
16 bit unsigned integer.
Definition: PixelType.h:97
ome::xml::model::enums::PixelType::COMPLEXDOUBLE
complex double-precision floating point.
Definition: PixelType.h:117
ome::xml::model::enums::PixelType::FLOAT
single-precision floating point.
Definition: PixelType.h:105
ome
Open Microscopy Environment C++ implementation.
ome::xml::model::enums::PixelType::name
const std::string * name
Enumeration name.
Definition: PixelType.h:221
ome::xml::model::enums::PixelType::value
enum_value value
Enumeration value.
Definition: PixelType.h:219
ome::xml::model::enums::PixelType::COMPLEXFLOAT
complex single-precision floating point.
Definition: PixelType.h:113
ome::xml::model::enums::PixelType::strings
static const string_map_type & strings()
Get a map of valid string names and enum values.
Definition: PixelType.cpp:138
ome::xml::model::enums::PixelType::value_map_type
std::map< PixelType::enum_value, std::string > value_map_type
Value map type.
Definition: PixelType.h:191
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::PixelType::DOUBLE
double-precision floating point.
Definition: PixelType.h:109
ome::xml::model::enums::PixelType
PixelType enumeration.
Definition: PixelType.h:72
ome::xml::model::enums::PixelType::INT32
32 bit signed integer.
Definition: PixelType.h:89
log.h
ome::xml::model::enums::PixelType::operator=
PixelType & operator=(const PixelType &rhs)
Assignment operator.
Definition: PixelType.h:159