ome-xml  5.2.2
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 
144  inline Correction&
145  operator= (const Correction& rhs)
146  {
147  this->value = rhs.value;
148  this->name = rhs.name;
149  return *this;
150  }
151 
157  inline
158  operator enum_value () const
159  {
160  return this->value;
161  }
162 
168  inline
169  operator const std::string& () const
170  {
171  return *this->name;
172  }
173 
175  typedef std::map<std::string, Correction::enum_value> string_map_type;
177  typedef std::map<Correction::enum_value, std::string> value_map_type;
178 
184  static const string_map_type&
185  strings();
186 
192  static const value_map_type&
193  values();
194 
195  private:
201  static const string_map_type&
203 
207  const std::string *name;
208  };
209 
217  inline bool
219  const Correction& rhs)
220  {
221  return static_cast<Correction::enum_value>(lhs) == static_cast<Correction::enum_value>(rhs);
222  }
223 
231  inline bool
233  const Correction::enum_value& rhs)
234  {
235  return static_cast<Correction::enum_value>(lhs) == rhs;
236  }
237 
245  inline bool
247  const Correction& rhs)
248  {
249  return lhs == static_cast<Correction::enum_value>(rhs);
250  }
251 
259  inline bool
261  const std::string& rhs)
262  {
263  return static_cast<const std::string&>(lhs) == rhs;
264  }
265 
273  inline bool
274  operator== (const std::string& lhs,
275  const Correction& rhs)
276  {
277  return lhs == static_cast<const std::string&>(rhs);
278  }
279 
287  inline bool
289  const Correction& rhs)
290  {
291  return static_cast<Correction::enum_value>(lhs) != static_cast<Correction::enum_value>(rhs);
292  }
293 
301  inline bool
303  const Correction::enum_value& rhs)
304  {
305  return static_cast<Correction::enum_value>(lhs) != rhs;
306  }
307 
315  inline bool
317  const Correction& rhs)
318  {
319  return lhs != static_cast<Correction::enum_value>(rhs);
320  }
321 
329  inline bool
331  const std::string& rhs)
332  {
333  return static_cast<const std::string&>(lhs) != rhs;
334  }
335 
343  inline bool
344  operator!= (const std::string& lhs,
345  const Correction& rhs)
346  {
347  return lhs != static_cast<const std::string&>(rhs);
348  }
349 
357  template<class charT, class traits>
358  inline std::basic_ostream<charT,traits>&
359  operator<< (std::basic_ostream<charT,traits>& os,
360  const Correction& enumeration)
361  {
362  return os << static_cast<const std::string&>(enumeration);
363  }
364 
372  template<class charT, class traits>
373  inline std::basic_istream<charT,traits>&
374  operator>> (std::basic_istream<charT,traits>& is,
375  Correction& enumeration)
376  {
377  std::string value;
378  is >> value;
379  if (is)
380  {
381  try
382  {
383  enumeration = Correction(value, false);
384  }
385  catch (const EnumerationException&)
386  {
387  is.setstate(std::ios::failbit);
388  }
389  }
390 
391  return is;
392  }
393 
394  }
395  }
396  }
397 }
398 
399 #endif // OME_XML_MODEL_ENUMS_CORRECTION_H
400 
401 /*
402  * Local Variables:
403  * mode:C++
404  * End:
405  */
std::basic_istream< charT, traits > & operator>>(std::basic_istream< charT, traits > &is, AcquisitionMode &enumeration)
Set AcquisitionMode from input stream.
Definition: AcquisitionMode.h:384
bool operator!=(const AcquisitionMode &lhs, const AcquisitionMode &rhs)
Compare two AcquisitionMode objects for non-equality.
Definition: AcquisitionMode.h:298
Correction enumeration.
Definition: Correction.h:72
Correction(enum_value value)
Construct a Correction enumeration by an enumeration value.
Definition: Correction.cpp:75
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:175
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:205
PlanApo.
Definition: Correction.h:81
static const string_map_type & strings()
Get a map of valid string names and enum values.
Definition: Correction.cpp:153
VioletCorrected.
Definition: Correction.h:87
SuperFluor.
Definition: Correction.h:85
Fl.
Definition: Correction.h:95
const std::string * name
Enumeration name.
Definition: Correction.h:207
Apo.
Definition: Correction.h:103
std::map< Correction::enum_value, std::string > value_map_type
Value map type.
Definition: Correction.h:177
Open Microscopy Environment C++ implementation.
Correction & operator=(const Correction &rhs)
Assignment operator.
Definition: Correction.h:145
bool operator==(const AcquisitionMode &lhs, const AcquisitionMode &rhs)
Compare two AcquisitionMode objects for equality.
Definition: AcquisitionMode.h:228
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:209
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:181