ome-xml  5.5.0
DetectorType.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_DETECTORTYPE_H
47 #define OME_XML_MODEL_ENUMS_DETECTORTYPE_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 DetectorType enumeration.
58 #define OME_XML_MODEL_ENUMS_DETECTORTYPE_VALUES (CCD)(INTENSIFIEDCCD)(ANALOGVIDEO)(PMT)(PHOTODIODE)(SPECTROSCOPY)(LIFETIMEIMAGING)(CORRELATIONSPECTROSCOPY)(FTIR)(EMCCD)(APD)(CMOS)(EBCCD)(OTHER)
59 
60 namespace ome
61 {
62  namespace xml
63  {
64  namespace model
65  {
66  namespace enums
67  {
68 
73  {
74  public:
77  {
79  CCD,
85  PMT,
99  APD,
106  };
107 
114 
129  DetectorType (const std::string& name, bool strict = true);
130 
136  DetectorType (const DetectorType& original);
137 
142  inline DetectorType&
144  {
145  this->value = rhs.value;
146  this->name = rhs.name;
147  return *this;
148  }
149 
155  inline
156  operator enum_value () const
157  {
158  return this->value;
159  }
160 
166  inline
167  operator const std::string& () const
168  {
169  return *this->name;
170  }
171 
173  typedef std::map<std::string, DetectorType::enum_value> string_map_type;
175  typedef std::map<DetectorType::enum_value, std::string> value_map_type;
176 
182  static const string_map_type&
183  strings();
184 
190  static const value_map_type&
191  values();
192 
193  private:
199  static const string_map_type&
201 
205  const std::string *name;
206  };
207 
215  inline bool
217  const DetectorType& rhs)
218  {
219  return static_cast<DetectorType::enum_value>(lhs) == static_cast<DetectorType::enum_value>(rhs);
220  }
221 
229  inline bool
231  const DetectorType::enum_value& rhs)
232  {
233  return static_cast<DetectorType::enum_value>(lhs) == rhs;
234  }
235 
243  inline bool
245  const DetectorType& rhs)
246  {
247  return lhs == static_cast<DetectorType::enum_value>(rhs);
248  }
249 
257  inline bool
259  const std::string& rhs)
260  {
261  return static_cast<const std::string&>(lhs) == rhs;
262  }
263 
271  inline bool
272  operator== (const std::string& lhs,
273  const DetectorType& rhs)
274  {
275  return lhs == static_cast<const std::string&>(rhs);
276  }
277 
285  inline bool
287  const DetectorType& rhs)
288  {
289  return static_cast<DetectorType::enum_value>(lhs) != static_cast<DetectorType::enum_value>(rhs);
290  }
291 
299  inline bool
301  const DetectorType::enum_value& rhs)
302  {
303  return static_cast<DetectorType::enum_value>(lhs) != rhs;
304  }
305 
313  inline bool
315  const DetectorType& rhs)
316  {
317  return lhs != static_cast<DetectorType::enum_value>(rhs);
318  }
319 
327  inline bool
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 DetectorType& rhs)
344  {
345  return lhs != static_cast<const std::string&>(rhs);
346  }
347 
355  template<class charT, class traits>
356  inline std::basic_ostream<charT,traits>&
357  operator<< (std::basic_ostream<charT,traits>& os,
358  const DetectorType& enumeration)
359  {
360  return os << static_cast<const std::string&>(enumeration);
361  }
362 
370  template<class charT, class traits>
371  inline std::basic_istream<charT,traits>&
372  operator>> (std::basic_istream<charT,traits>& is,
373  DetectorType& enumeration)
374  {
375  std::string value;
376  is >> value;
377  if (is)
378  {
379  try
380  {
381  enumeration = DetectorType(value, false);
382  }
383  catch (const EnumerationException&)
384  {
385  is.setstate(std::ios::failbit);
386  }
387  }
388 
389  return is;
390  }
391 
392  }
393  }
394  }
395 }
396 
397 #endif // OME_XML_MODEL_ENUMS_DETECTORTYPE_H
398 
399 /*
400  * Local Variables:
401  * mode:C++
402  * End:
403  */
std::basic_istream< charT, traits > & operator>>(std::basic_istream< charT, traits > &is, AcquisitionMode &enumeration)
Set AcquisitionMode from input stream.
Definition: AcquisitionMode.h:390
bool operator!=(const AcquisitionMode &lhs, const AcquisitionMode &rhs)
Compare two AcquisitionMode objects for non-equality.
Definition: AcquisitionMode.h:304
const std::string * name
Enumeration name.
Definition: DetectorType.h:205
IntensifiedCCD.
Definition: DetectorType.h:81
enum_value
Enumeration values.
Definition: DetectorType.h:76
EnumerationException is thrown when an enumeration is invalid or not found.
Definition: EnumerationException.h:74
enum_value value
Enumeration value.
Definition: DetectorType.h:203
Photodiode.
Definition: DetectorType.h:87
APD.
Definition: DetectorType.h:99
static const string_map_type & strings()
Get a map of valid string names and enum values.
Definition: DetectorType.cpp:145
EBCCD.
Definition: DetectorType.h:103
EMCCD.
Definition: DetectorType.h:97
Open Microscopy Environment C++ implementation.
PMT.
Definition: DetectorType.h:85
DetectorType(enum_value value)
Construct a DetectorType enumeration by an enumeration value.
Definition: DetectorType.cpp:67
DetectorType enumeration.
Definition: DetectorType.h:72
CorrelationSpectroscopy.
Definition: DetectorType.h:93
bool operator==(const AcquisitionMode &lhs, const AcquisitionMode &rhs)
Compare two AcquisitionMode objects for equality.
Definition: AcquisitionMode.h:234
static const string_map_type & lowercase_strings()
Get a map of valid lowercased string names and enum values.
Definition: DetectorType.cpp:193
std::map< DetectorType::enum_value, std::string > value_map_type
Value map type.
Definition: DetectorType.h:175
Spectroscopy.
Definition: DetectorType.h:89
DetectorType & operator=(const DetectorType &rhs)
Assignment operator.
Definition: DetectorType.h:143
std::map< std::string, DetectorType::enum_value > string_map_type
String map type.
Definition: DetectorType.h:173
CCD.
Definition: DetectorType.h:79
FTIR.
Definition: DetectorType.h:95
Other.
Definition: DetectorType.h:105
LifetimeImaging.
Definition: DetectorType.h:91
AnalogVideo.
Definition: DetectorType.h:83
CMOS.
Definition: DetectorType.h:101
static const value_map_type & values()
Get a map of valid enum values and string names.
Definition: DetectorType.cpp:169