ome-xml 5.2.3

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
72 class ContrastMethod
73 {
74 public:
76 enum enum_value
77 {
79 BRIGHTFIELD,
81 PHASE,
83 DIC,
85 HOFFMANMODULATION,
87 OBLIQUEILLUMINATION,
89 POLARIZEDLIGHT,
91 DARKFIELD,
93 FLUORESCENCE,
95 OTHER
96 };
97
103 ContrastMethod (enum_value value);
104
119 ContrastMethod (const std::string& name, bool strict = true);
120
126 ContrastMethod (const ContrastMethod& original);
127
132 inline ContrastMethod&
133 operator= (const ContrastMethod& rhs)
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&
190 lowercase_strings();
191
193 enum_value value;
195 const std::string *name;
196 };
197
205 inline bool
206 operator== (const ContrastMethod& lhs,
207 const ContrastMethod& rhs)
208 {
209 return static_cast<ContrastMethod::enum_value>(lhs) == static_cast<ContrastMethod::enum_value>(rhs);
210 }
211
219 inline bool
220 operator== (const ContrastMethod& lhs,
221 const ContrastMethod::enum_value& rhs)
222 {
223 return static_cast<ContrastMethod::enum_value>(lhs) == rhs;
224 }
225
233 inline bool
234 operator== (const ContrastMethod::enum_value& lhs,
235 const ContrastMethod& rhs)
236 {
237 return lhs == static_cast<ContrastMethod::enum_value>(rhs);
238 }
239
247 inline bool
248 operator== (const ContrastMethod& lhs,
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
276 operator!= (const ContrastMethod& lhs,
277 const ContrastMethod& rhs)
278 {
279 return static_cast<ContrastMethod::enum_value>(lhs) != static_cast<ContrastMethod::enum_value>(rhs);
280 }
281
289 inline bool
290 operator!= (const ContrastMethod& lhs,
291 const ContrastMethod::enum_value& rhs)
292 {
293 return static_cast<ContrastMethod::enum_value>(lhs) != rhs;
294 }
295
303 inline bool
304 operator!= (const ContrastMethod::enum_value& lhs,
305 const ContrastMethod& rhs)
306 {
307 return lhs != static_cast<ContrastMethod::enum_value>(rhs);
308 }
309
317 inline bool
318 operator!= (const ContrastMethod& lhs,
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 */
ome::xml::model::enums::operator>>
std::basic_istream< charT, traits > & operator>>(std::basic_istream< charT, traits > &is, AcquisitionMode &enumeration)
Set AcquisitionMode from input stream.
Definition: AcquisitionMode.h:390
ome::xml::model::enums::operator!=
bool operator!=(const AcquisitionMode &lhs, const AcquisitionMode &rhs)
Compare two AcquisitionMode objects for non-equality.
Definition: AcquisitionMode.h:304
ome::xml::model::enums::EnumerationException
EnumerationException is thrown when an enumeration is invalid or not found.
Definition: EnumerationException.h:74
ome::xml::model::enums::ContrastMethod::DARKFIELD
Darkfield.
Definition: ContrastMethod.h:91
ome::xml::model::enums::ContrastMethod::BRIGHTFIELD
Brightfield.
Definition: ContrastMethod.h:79
ome::xml::model::enums::ContrastMethod::PHASE
Phase.
Definition: ContrastMethod.h:81
ome::xml::model::enums::ContrastMethod::value_map_type
std::map< ContrastMethod::enum_value, std::string > value_map_type
Value map type.
Definition: ContrastMethod.h:165
ome::xml::model::enums::ContrastMethod::strings
static const string_map_type & strings()
Get a map of valid string names and enum values.
Definition: ContrastMethod.cpp:153
ome::xml::model::enums::ContrastMethod::OBLIQUEILLUMINATION
ObliqueIllumination.
Definition: ContrastMethod.h:87
ome::xml::model::enums::ContrastMethod::OTHER
Other.
Definition: ContrastMethod.h:95
ome::xml::model::enums::ContrastMethod::DIC
DIC.
Definition: ContrastMethod.h:83
ome::xml::model::enums::ContrastMethod
ContrastMethod enumeration.
Definition: ContrastMethod.h:72
ome::xml::model::enums::ContrastMethod::operator=
ContrastMethod & operator=(const ContrastMethod &rhs)
Assignment operator.
Definition: ContrastMethod.h:133
ome::xml::model::enums::ContrastMethod::POLARIZEDLIGHT
PolarizedLight.
Definition: ContrastMethod.h:89
ome
Open Microscopy Environment C++ implementation.
ome::xml::model::enums::ContrastMethod::string_map_type
std::map< std::string, ContrastMethod::enum_value > string_map_type
String map type.
Definition: ContrastMethod.h:163
ome::xml::model::enums::ContrastMethod::enum_value
enum_value
Enumeration values.
Definition: ContrastMethod.h:76
ome::xml::model::enums::operator==
bool operator==(const AcquisitionMode &lhs, const AcquisitionMode &rhs)
Compare two AcquisitionMode objects for equality.
Definition: AcquisitionMode.h:234
ome::xml::model::enums::ContrastMethod::HOFFMANMODULATION
HoffmanModulation.
Definition: ContrastMethod.h:85
ome::xml::model::enums::ContrastMethod::value
enum_value value
Enumeration value.
Definition: ContrastMethod.h:193
ome::xml::model::enums::ContrastMethod::ContrastMethod
ContrastMethod(enum_value value)
Construct a ContrastMethod enumeration by an enumeration value.
Definition: ContrastMethod.cpp:75
ome::xml::model::enums::ContrastMethod::lowercase_strings
static const string_map_type & lowercase_strings()
Get a map of valid lowercased string names and enum values.
Definition: ContrastMethod.cpp:197
ome::xml::model::enums::ContrastMethod::values
static const value_map_type & values()
Get a map of valid enum values and string names.
Definition: ContrastMethod.cpp:175
ome::xml::model::enums::ContrastMethod::FLUORESCENCE
Fluorescence.
Definition: ContrastMethod.h:93
ome::xml::model::enums::ContrastMethod::name
const std::string * name
Enumeration name.
Definition: ContrastMethod.h:195
log.h