ome-xml  5.2.0
ContrastMethod.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_CONTRASTMETHOD_H
47 #define OME_XML_MODEL_ENUMS_CONTRASTMETHOD_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 ContrastMethod enumeration.
58 #define OME_XML_MODEL_ENUMS_CONTRASTMETHOD_VALUES (BRIGHTFIELD)(PHASE)(DIC)(HOFFMANMODULATION)(OBLIQUEILLUMINATION)(POLARIZEDLIGHT)(DARKFIELD)(FLUORESCENCE)(OTHER)
59 
60 namespace ome
61 {
62  namespace xml
63  {
64  namespace model
65  {
66  namespace enums
67  {
68 
73  {
74  public:
77  {
83  DIC,
96  };
97 
104 
119  ContrastMethod (const std::string& name, bool strict = true);
120 
126  ContrastMethod (const ContrastMethod& original);
127 
132  inline ContrastMethod&
134  {
135  this->value = rhs.value;
136  this->name = rhs.name;
137  return *this;
138  }
139 
145  inline
146  operator enum_value () const
147  {
148  return this->value;
149  }
150 
156  inline
157  operator const std::string& () const
158  {
159  return *this->name;
160  }
161 
163  typedef std::map<std::string, ContrastMethod::enum_value> string_map_type;
165  typedef std::map<ContrastMethod::enum_value, std::string> value_map_type;
166 
172  static const string_map_type&
173  strings();
174 
180  static const value_map_type&
181  values();
182 
183  private:
189  static const string_map_type&
191 
195  const std::string *name;
196  };
197 
205  inline bool
207  const ContrastMethod& rhs)
208  {
209  return static_cast<ContrastMethod::enum_value>(lhs) == static_cast<ContrastMethod::enum_value>(rhs);
210  }
211 
219  inline bool
221  const ContrastMethod::enum_value& rhs)
222  {
223  return static_cast<ContrastMethod::enum_value>(lhs) == rhs;
224  }
225 
233  inline bool
235  const ContrastMethod& rhs)
236  {
237  return lhs == static_cast<ContrastMethod::enum_value>(rhs);
238  }
239 
247  inline bool
249  const std::string& rhs)
250  {
251  return static_cast<const std::string&>(lhs) == rhs;
252  }
253 
261  inline bool
262  operator== (const std::string& lhs,
263  const ContrastMethod& rhs)
264  {
265  return lhs == static_cast<const std::string&>(rhs);
266  }
267 
275  inline bool
277  const ContrastMethod& rhs)
278  {
279  return static_cast<ContrastMethod::enum_value>(lhs) != static_cast<ContrastMethod::enum_value>(rhs);
280  }
281 
289  inline bool
291  const ContrastMethod::enum_value& rhs)
292  {
293  return static_cast<ContrastMethod::enum_value>(lhs) != rhs;
294  }
295 
303  inline bool
305  const ContrastMethod& rhs)
306  {
307  return lhs != static_cast<ContrastMethod::enum_value>(rhs);
308  }
309 
317  inline bool
319  const std::string& rhs)
320  {
321  return static_cast<const std::string&>(lhs) != rhs;
322  }
323 
331  inline bool
332  operator!= (const std::string& lhs,
333  const ContrastMethod& rhs)
334  {
335  return lhs != static_cast<const std::string&>(rhs);
336  }
337 
345  template<class charT, class traits>
346  inline std::basic_ostream<charT,traits>&
347  operator<< (std::basic_ostream<charT,traits>& os,
348  const ContrastMethod& enumeration)
349  {
350  return os << static_cast<const std::string&>(enumeration);
351  }
352 
360  template<class charT, class traits>
361  inline std::basic_istream<charT,traits>&
362  operator>> (std::basic_istream<charT,traits>& is,
363  ContrastMethod& enumeration)
364  {
365  std::string value;
366  is >> value;
367  if (is)
368  {
369  try
370  {
371  enumeration = ContrastMethod(value, false);
372  }
373  catch (const EnumerationException&)
374  {
375  is.setstate(std::ios::failbit);
376  }
377  }
378 
379  return is;
380  }
381 
382  }
383  }
384  }
385 }
386 
387 #endif // OME_XML_MODEL_ENUMS_CONTRASTMETHOD_H
388 
389 /*
390  * Local Variables:
391  * mode:C++
392  * End:
393  */
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
EnumerationException is thrown when an enumeration is invalid or not found.
Definition: EnumerationException.h:74
Darkfield.
Definition: ContrastMethod.h:91
Brightfield.
Definition: ContrastMethod.h:79
Phase.
Definition: ContrastMethod.h:81
std::map< ContrastMethod::enum_value, std::string > value_map_type
Value map type.
Definition: ContrastMethod.h:165
static const string_map_type & strings()
Get a map of valid string names and enum values.
Definition: ContrastMethod.cpp:153
ObliqueIllumination.
Definition: ContrastMethod.h:87
Other.
Definition: ContrastMethod.h:95
DIC.
Definition: ContrastMethod.h:83
ContrastMethod enumeration.
Definition: ContrastMethod.h:72
ContrastMethod & operator=(const ContrastMethod &rhs)
Assignment operator.
Definition: ContrastMethod.h:133
PolarizedLight.
Definition: ContrastMethod.h:89
Open Microscopy Environment C++ implementation.
std::map< std::string, ContrastMethod::enum_value > string_map_type
String map type.
Definition: ContrastMethod.h:163
enum_value
Enumeration values.
Definition: ContrastMethod.h:76
bool operator==(const AcquisitionMode &lhs, const AcquisitionMode &rhs)
Compare two AcquisitionMode objects for equality.
Definition: AcquisitionMode.h:228
HoffmanModulation.
Definition: ContrastMethod.h:85
enum_value value
Enumeration value.
Definition: ContrastMethod.h:193
ContrastMethod(enum_value value)
Construct a ContrastMethod enumeration by an enumeration value.
Definition: ContrastMethod.cpp:75
static const string_map_type & lowercase_strings()
Get a map of valid lowercased string names and enum values.
Definition: ContrastMethod.cpp:197
static const value_map_type & values()
Get a map of valid enum values and string names.
Definition: ContrastMethod.cpp:175
Fluorescence.
Definition: ContrastMethod.h:93
const std::string * name
Enumeration name.
Definition: ContrastMethod.h:195