ome-xml  5.6.0
Correction.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_CORRECTION_H
47 #define OME_XML_MODEL_ENUMS_CORRECTION_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 Correction enumeration.
58 #define OME_XML_MODEL_ENUMS_CORRECTION_VALUES (UV)(PLANAPO)(PLANFLUOR)(SUPERFLUOR)(VIOLETCORRECTED)(ACHRO)(ACHROMAT)(FLUOR)(FL)(FLUAR)(NEOFLUAR)(FLUOTAR)(APO)(PLANNEOFLUAR)(OTHER)
59 
60 namespace ome
61 {
62  namespace xml
63  {
64  namespace model
65  {
66  namespace enums
67  {
68 
72  class Correction
73  {
74  public:
77  {
79  UV,
95  FL,
108  };
109 
116 
131  Correction (const std::string& name, bool strict = true);
132 
138  Correction (const Correction& original);
139 
146  inline Correction&
147  operator= (const Correction& rhs)
148  {
149  this->value = rhs.value;
150  this->name = rhs.name;
151  return *this;
152  }
153 
159  inline
160  operator enum_value () const
161  {
162  return this->value;
163  }
164 
170  inline
171  operator const std::string& () const
172  {
173  return *this->name;
174  }
175 
177  typedef std::map<std::string, Correction::enum_value> string_map_type;
179  typedef std::map<Correction::enum_value, std::string> value_map_type;
180 
186  static const string_map_type&
187  strings();
188 
194  static const value_map_type&
195  values();
196 
197  private:
203  static const string_map_type&
205 
209  const std::string *name;
210  };
211 
219  inline bool
221  const Correction& rhs)
222  {
223  return static_cast<Correction::enum_value>(lhs) == static_cast<Correction::enum_value>(rhs);
224  }
225 
233  inline bool
235  const Correction::enum_value& rhs)
236  {
237  return static_cast<Correction::enum_value>(lhs) == rhs;
238  }
239 
247  inline bool
249  const Correction& rhs)
250  {
251  return lhs == static_cast<Correction::enum_value>(rhs);
252  }
253 
261  inline bool
263  const std::string& rhs)
264  {
265  return static_cast<const std::string&>(lhs) == rhs;
266  }
267 
275  inline bool
276  operator== (const std::string& lhs,
277  const Correction& rhs)
278  {
279  return lhs == static_cast<const std::string&>(rhs);
280  }
281 
289  inline bool
291  const Correction& rhs)
292  {
293  return static_cast<Correction::enum_value>(lhs) != static_cast<Correction::enum_value>(rhs);
294  }
295 
303  inline bool
305  const Correction::enum_value& rhs)
306  {
307  return static_cast<Correction::enum_value>(lhs) != rhs;
308  }
309 
317  inline bool
319  const Correction& rhs)
320  {
321  return lhs != static_cast<Correction::enum_value>(rhs);
322  }
323 
331  inline bool
333  const std::string& rhs)
334  {
335  return static_cast<const std::string&>(lhs) != rhs;
336  }
337 
345  inline bool
346  operator!= (const std::string& lhs,
347  const Correction& rhs)
348  {
349  return lhs != static_cast<const std::string&>(rhs);
350  }
351 
359  template<class charT, class traits>
360  inline std::basic_ostream<charT,traits>&
361  operator<< (std::basic_ostream<charT,traits>& os,
362  const Correction& enumeration)
363  {
364  return os << static_cast<const std::string&>(enumeration);
365  }
366 
374  template<class charT, class traits>
375  inline std::basic_istream<charT,traits>&
376  operator>> (std::basic_istream<charT,traits>& is,
377  Correction& enumeration)
378  {
379  std::string value;
380  is >> value;
381  if (is)
382  {
383  try
384  {
385  enumeration = Correction(value, false);
386  }
387  catch (const EnumerationException&)
388  {
389  is.setstate(std::ios::failbit);
390  }
391  }
392 
393  return is;
394  }
395 
396  }
397  }
398  }
399 }
400 
401 #endif // OME_XML_MODEL_ENUMS_CORRECTION_H
402 
403 /*
404  * Local Variables:
405  * mode:C++
406  * End:
407  */
std::basic_istream< charT, traits > & operator>>(std::basic_istream< charT, traits > &is, AcquisitionMode &enumeration)
Set AcquisitionMode from input stream.
Definition: AcquisitionMode.h:392
bool operator!=(const AcquisitionMode &lhs, const AcquisitionMode &rhs)
Compare two AcquisitionMode objects for non-equality.
Definition: AcquisitionMode.h:306
Correction enumeration.
Definition: Correction.h:72
Correction(enum_value value)
Construct a Correction enumeration by an enumeration value.
Definition: Correction.cpp:67
Fluotar.
Definition: Correction.h:101
PlanNeofluar.
Definition: Correction.h:105
std::map< std::string, Correction::enum_value > string_map_type
String map type.
Definition: Correction.h:177
EnumerationException is thrown when an enumeration is invalid or not found.
Definition: EnumerationException.h:74
Neofluar.
Definition: Correction.h:99
Other.
Definition: Correction.h:107
enum_value
Enumeration values.
Definition: Correction.h:76
Achro.
Definition: Correction.h:89
enum_value value
Enumeration value.
Definition: Correction.h:207
PlanApo.
Definition: Correction.h:81
static const string_map_type & strings()
Get a map of valid string names and enum values.
Definition: Correction.cpp:145
VioletCorrected.
Definition: Correction.h:87
SuperFluor.
Definition: Correction.h:85
Fl.
Definition: Correction.h:95
const std::string * name
Enumeration name.
Definition: Correction.h:209
Apo.
Definition: Correction.h:103
std::map< Correction::enum_value, std::string > value_map_type
Value map type.
Definition: Correction.h:179
Open Microscopy Environment C++ implementation.
Correction & operator=(const Correction &rhs)
Assignment operator.
Definition: Correction.h:147
bool operator==(const AcquisitionMode &lhs, const AcquisitionMode &rhs)
Compare two AcquisitionMode objects for equality.
Definition: AcquisitionMode.h:236
Fluar.
Definition: Correction.h:97
static const string_map_type & lowercase_strings()
Get a map of valid lowercased string names and enum values.
Definition: Correction.cpp:195
UV.
Definition: Correction.h:79
Fluor.
Definition: Correction.h:93
Achromat.
Definition: Correction.h:91
PlanFluor.
Definition: Correction.h:83
static const value_map_type & values()
Get a map of valid enum values and string names.
Definition: Correction.cpp:170