ome-xml  5.2.0-m5
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:
77  {
122  };
123 
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&
217 
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
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
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  */
32 bit unsigned integer.
Definition: PixelType.h:101
std::basic_istream< charT, traits > & operator>>(std::basic_istream< charT, traits > &is, AcquisitionMode &enumeration)
Set AcquisitionMode from input stream.
Definition: AcquisitionMode.h:384
8 bit unsigned integer.
Definition: PixelType.h:93
bool operator!=(const AcquisitionMode &lhs, const AcquisitionMode &rhs)
Compare two AcquisitionMode objects for non-equality.
Definition: AcquisitionMode.h:298
PixelType(enum_value value)
Construct a PixelType enumeration by an enumeration value.
Definition: PixelType.cpp:75
bit mask.
Definition: PixelType.h:121
EnumerationException is thrown when an enumeration is invalid or not found.
Definition: EnumerationException.h:74
8 bit signed integer.
Definition: PixelType.h:81
static const string_map_type & lowercase_strings()
Get a map of valid lowercased string names and enum values.
Definition: PixelType.cpp:186
std::map< std::string, PixelType::enum_value > string_map_type
String map type.
Definition: PixelType.h:189
static const value_map_type & values()
Get a map of valid enum values and string names.
Definition: PixelType.cpp:162
enum_value
Enumeration values.
Definition: PixelType.h:76
16 bit signed integer.
Definition: PixelType.h:85
16 bit unsigned integer.
Definition: PixelType.h:97
complex double-precision floating point.
Definition: PixelType.h:117
single-precision floating point.
Definition: PixelType.h:105
Open Microscopy Environment C++ implementation.
const std::string * name
Enumeration name.
Definition: PixelType.h:221
enum_value value
Enumeration value.
Definition: PixelType.h:219
complex single-precision floating point.
Definition: PixelType.h:113
static const string_map_type & strings()
Get a map of valid string names and enum values.
Definition: PixelType.cpp:138
std::map< PixelType::enum_value, std::string > value_map_type
Value map type.
Definition: PixelType.h:191
bool operator==(const AcquisitionMode &lhs, const AcquisitionMode &rhs)
Compare two AcquisitionMode objects for equality.
Definition: AcquisitionMode.h:228
double-precision floating point.
Definition: PixelType.h:109
PixelType enumeration.
Definition: PixelType.h:72
32 bit signed integer.
Definition: PixelType.h:89
PixelType & operator=(const PixelType &rhs)
Assignment operator.
Definition: PixelType.h:159