ome-xml  5.2.0
Immersion.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_IMMERSION_H
47 #define OME_XML_MODEL_ENUMS_IMMERSION_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 Immersion enumeration.
58 #define OME_XML_MODEL_ENUMS_IMMERSION_VALUES (OIL)(WATER)(WATERDIPPING)(AIR)(MULTI)(GLYCEROL)(OTHER)
59 
60 namespace ome
61 {
62  namespace xml
63  {
64  namespace model
65  {
66  namespace enums
67  {
68 
72  class Immersion
73  {
74  public:
77  {
79  OIL,
85  AIR,
92  };
93 
100 
115  Immersion (const std::string& name, bool strict = true);
116 
122  Immersion (const Immersion& original);
123 
128  inline Immersion&
129  operator= (const Immersion& rhs)
130  {
131  this->value = rhs.value;
132  this->name = rhs.name;
133  return *this;
134  }
135 
141  inline
142  operator enum_value () const
143  {
144  return this->value;
145  }
146 
152  inline
153  operator const std::string& () const
154  {
155  return *this->name;
156  }
157 
159  typedef std::map<std::string, Immersion::enum_value> string_map_type;
161  typedef std::map<Immersion::enum_value, std::string> value_map_type;
162 
168  static const string_map_type&
169  strings();
170 
176  static const value_map_type&
177  values();
178 
179  private:
185  static const string_map_type&
187 
191  const std::string *name;
192  };
193 
201  inline bool
202  operator== (const Immersion& lhs,
203  const Immersion& rhs)
204  {
205  return static_cast<Immersion::enum_value>(lhs) == static_cast<Immersion::enum_value>(rhs);
206  }
207 
215  inline bool
216  operator== (const Immersion& lhs,
217  const Immersion::enum_value& rhs)
218  {
219  return static_cast<Immersion::enum_value>(lhs) == rhs;
220  }
221 
229  inline bool
231  const Immersion& rhs)
232  {
233  return lhs == static_cast<Immersion::enum_value>(rhs);
234  }
235 
243  inline bool
244  operator== (const Immersion& lhs,
245  const std::string& rhs)
246  {
247  return static_cast<const std::string&>(lhs) == rhs;
248  }
249 
257  inline bool
258  operator== (const std::string& lhs,
259  const Immersion& rhs)
260  {
261  return lhs == static_cast<const std::string&>(rhs);
262  }
263 
271  inline bool
272  operator!= (const Immersion& lhs,
273  const Immersion& rhs)
274  {
275  return static_cast<Immersion::enum_value>(lhs) != static_cast<Immersion::enum_value>(rhs);
276  }
277 
285  inline bool
286  operator!= (const Immersion& lhs,
287  const Immersion::enum_value& rhs)
288  {
289  return static_cast<Immersion::enum_value>(lhs) != rhs;
290  }
291 
299  inline bool
301  const Immersion& rhs)
302  {
303  return lhs != static_cast<Immersion::enum_value>(rhs);
304  }
305 
313  inline bool
314  operator!= (const Immersion& lhs,
315  const std::string& rhs)
316  {
317  return static_cast<const std::string&>(lhs) != rhs;
318  }
319 
327  inline bool
328  operator!= (const std::string& lhs,
329  const Immersion& rhs)
330  {
331  return lhs != static_cast<const std::string&>(rhs);
332  }
333 
341  template<class charT, class traits>
342  inline std::basic_ostream<charT,traits>&
343  operator<< (std::basic_ostream<charT,traits>& os,
344  const Immersion& enumeration)
345  {
346  return os << static_cast<const std::string&>(enumeration);
347  }
348 
356  template<class charT, class traits>
357  inline std::basic_istream<charT,traits>&
358  operator>> (std::basic_istream<charT,traits>& is,
359  Immersion& enumeration)
360  {
361  std::string value;
362  is >> value;
363  if (is)
364  {
365  try
366  {
367  enumeration = Immersion(value, false);
368  }
369  catch (const EnumerationException&)
370  {
371  is.setstate(std::ios::failbit);
372  }
373  }
374 
375  return is;
376  }
377 
378  }
379  }
380  }
381 }
382 
383 #endif // OME_XML_MODEL_ENUMS_IMMERSION_H
384 
385 /*
386  * Local Variables:
387  * mode:C++
388  * End:
389  */
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
enum_value value
Enumeration value.
Definition: Immersion.h:189
static const string_map_type & lowercase_strings()
Get a map of valid lowercased string names and enum values.
Definition: Immersion.cpp:193
Air.
Definition: Immersion.h:85
Immersion(enum_value value)
Construct a Immersion enumeration by an enumeration value.
Definition: Immersion.cpp:75
Other.
Definition: Immersion.h:91
EnumerationException is thrown when an enumeration is invalid or not found.
Definition: EnumerationException.h:74
std::map< std::string, Immersion::enum_value > string_map_type
String map type.
Definition: Immersion.h:159
Immersion enumeration.
Definition: Immersion.h:72
std::map< Immersion::enum_value, std::string > value_map_type
Value map type.
Definition: Immersion.h:161
Open Microscopy Environment C++ implementation.
static const value_map_type & values()
Get a map of valid enum values and string names.
Definition: Immersion.cpp:173
bool operator==(const AcquisitionMode &lhs, const AcquisitionMode &rhs)
Compare two AcquisitionMode objects for equality.
Definition: AcquisitionMode.h:228
WaterDipping.
Definition: Immersion.h:83
Glycerol.
Definition: Immersion.h:89
static const string_map_type & strings()
Get a map of valid string names and enum values.
Definition: Immersion.cpp:153
Immersion & operator=(const Immersion &rhs)
Assignment operator.
Definition: Immersion.h:129
const std::string * name
Enumeration name.
Definition: Immersion.h:191
Oil.
Definition: Immersion.h:79
enum_value
Enumeration values.
Definition: Immersion.h:76
Multi.
Definition: Immersion.h:87
Water.
Definition: Immersion.h:81