ome-xml  5.6.0
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 
160  inline PixelType&
161  operator= (const PixelType& rhs)
162  {
163  this->value = rhs.value;
164  this->name = rhs.name;
165  return *this;
166  }
167 
173  inline
174  operator enum_value () const
175  {
176  return this->value;
177  }
178 
184  inline
185  operator const std::string& () const
186  {
187  return *this->name;
188  }
189 
191  typedef std::map<std::string, PixelType::enum_value> string_map_type;
193  typedef std::map<PixelType::enum_value, std::string> value_map_type;
194 
200  static const string_map_type&
201  strings();
202 
208  static const value_map_type&
209  values();
210 
211  private:
217  static const string_map_type&
219 
223  const std::string *name;
224  };
225 
233  inline bool
234  operator== (const PixelType& lhs,
235  const PixelType& rhs)
236  {
237  return static_cast<PixelType::enum_value>(lhs) == static_cast<PixelType::enum_value>(rhs);
238  }
239 
247  inline bool
248  operator== (const PixelType& lhs,
249  const PixelType::enum_value& rhs)
250  {
251  return static_cast<PixelType::enum_value>(lhs) == rhs;
252  }
253 
261  inline bool
263  const PixelType& rhs)
264  {
265  return lhs == static_cast<PixelType::enum_value>(rhs);
266  }
267 
275  inline bool
276  operator== (const PixelType& lhs,
277  const std::string& rhs)
278  {
279  return static_cast<const std::string&>(lhs) == rhs;
280  }
281 
289  inline bool
290  operator== (const std::string& lhs,
291  const PixelType& rhs)
292  {
293  return lhs == static_cast<const std::string&>(rhs);
294  }
295 
303  inline bool
304  operator!= (const PixelType& lhs,
305  const PixelType& rhs)
306  {
307  return static_cast<PixelType::enum_value>(lhs) != static_cast<PixelType::enum_value>(rhs);
308  }
309 
317  inline bool
318  operator!= (const PixelType& lhs,
319  const PixelType::enum_value& rhs)
320  {
321  return static_cast<PixelType::enum_value>(lhs) != rhs;
322  }
323 
331  inline bool
333  const PixelType& rhs)
334  {
335  return lhs != static_cast<PixelType::enum_value>(rhs);
336  }
337 
345  inline bool
346  operator!= (const PixelType& lhs,
347  const std::string& rhs)
348  {
349  return static_cast<const std::string&>(lhs) != rhs;
350  }
351 
359  inline bool
360  operator!= (const std::string& lhs,
361  const PixelType& rhs)
362  {
363  return lhs != static_cast<const std::string&>(rhs);
364  }
365 
373  template<class charT, class traits>
374  inline std::basic_ostream<charT,traits>&
375  operator<< (std::basic_ostream<charT,traits>& os,
376  const PixelType& enumeration)
377  {
378  return os << static_cast<const std::string&>(enumeration);
379  }
380 
388  template<class charT, class traits>
389  inline std::basic_istream<charT,traits>&
390  operator>> (std::basic_istream<charT,traits>& is,
391  PixelType& enumeration)
392  {
393  std::string value;
394  is >> value;
395  if (is)
396  {
397  try
398  {
399  enumeration = PixelType(value, false);
400  }
401  catch (const EnumerationException&)
402  {
403  is.setstate(std::ios::failbit);
404  }
405  }
406 
407  return is;
408  }
409 
410  }
411  }
412  }
413 }
414 
415 #endif // OME_XML_MODEL_ENUMS_PIXELTYPE_H
416 
417 /*
418  * Local Variables:
419  * mode:C++
420  * End:
421  */
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:392
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:306
PixelType(enum_value value)
Construct a PixelType enumeration by an enumeration value.
Definition: PixelType.cpp:67
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:172
std::map< std::string, PixelType::enum_value > string_map_type
String map type.
Definition: PixelType.h:191
static const value_map_type & values()
Get a map of valid enum values and string names.
Definition: PixelType.cpp:151
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:223
enum_value value
Enumeration value.
Definition: PixelType.h:221
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:130
std::map< PixelType::enum_value, std::string > value_map_type
Value map type.
Definition: PixelType.h:193
bool operator==(const AcquisitionMode &lhs, const AcquisitionMode &rhs)
Compare two AcquisitionMode objects for equality.
Definition: AcquisitionMode.h:236
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:161