ome-xml  5.6.0
Marker.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_MARKER_H
47 #define OME_XML_MODEL_ENUMS_MARKER_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 Marker enumeration.
58 #define OME_XML_MODEL_ENUMS_MARKER_VALUES (ARROW)
59 
60 namespace ome
61 {
62  namespace xml
63  {
64  namespace model
65  {
66  namespace enums
67  {
68 
72  class Marker
73  {
74  public:
77  {
80  };
81 
88 
103  Marker (const std::string& name, bool strict = true);
104 
110  Marker (const Marker& original);
111 
118  inline Marker&
119  operator= (const Marker& rhs)
120  {
121  this->value = rhs.value;
122  this->name = rhs.name;
123  return *this;
124  }
125 
131  inline
132  operator enum_value () const
133  {
134  return this->value;
135  }
136 
142  inline
143  operator const std::string& () const
144  {
145  return *this->name;
146  }
147 
149  typedef std::map<std::string, Marker::enum_value> string_map_type;
151  typedef std::map<Marker::enum_value, std::string> value_map_type;
152 
158  static const string_map_type&
159  strings();
160 
166  static const value_map_type&
167  values();
168 
169  private:
175  static const string_map_type&
177 
181  const std::string *name;
182  };
183 
191  inline bool
192  operator== (const Marker& lhs,
193  const Marker& rhs)
194  {
195  return static_cast<Marker::enum_value>(lhs) == static_cast<Marker::enum_value>(rhs);
196  }
197 
205  inline bool
206  operator== (const Marker& lhs,
207  const Marker::enum_value& rhs)
208  {
209  return static_cast<Marker::enum_value>(lhs) == rhs;
210  }
211 
219  inline bool
221  const Marker& rhs)
222  {
223  return lhs == static_cast<Marker::enum_value>(rhs);
224  }
225 
233  inline bool
234  operator== (const Marker& lhs,
235  const std::string& rhs)
236  {
237  return static_cast<const std::string&>(lhs) == rhs;
238  }
239 
247  inline bool
248  operator== (const std::string& lhs,
249  const Marker& rhs)
250  {
251  return lhs == static_cast<const std::string&>(rhs);
252  }
253 
261  inline bool
262  operator!= (const Marker& lhs,
263  const Marker& rhs)
264  {
265  return static_cast<Marker::enum_value>(lhs) != static_cast<Marker::enum_value>(rhs);
266  }
267 
275  inline bool
276  operator!= (const Marker& lhs,
277  const Marker::enum_value& rhs)
278  {
279  return static_cast<Marker::enum_value>(lhs) != rhs;
280  }
281 
289  inline bool
291  const Marker& rhs)
292  {
293  return lhs != static_cast<Marker::enum_value>(rhs);
294  }
295 
303  inline bool
304  operator!= (const Marker& lhs,
305  const std::string& rhs)
306  {
307  return static_cast<const std::string&>(lhs) != rhs;
308  }
309 
317  inline bool
318  operator!= (const std::string& lhs,
319  const Marker& rhs)
320  {
321  return lhs != static_cast<const std::string&>(rhs);
322  }
323 
331  template<class charT, class traits>
332  inline std::basic_ostream<charT,traits>&
333  operator<< (std::basic_ostream<charT,traits>& os,
334  const Marker& enumeration)
335  {
336  return os << static_cast<const std::string&>(enumeration);
337  }
338 
346  template<class charT, class traits>
347  inline std::basic_istream<charT,traits>&
348  operator>> (std::basic_istream<charT,traits>& is,
349  Marker& enumeration)
350  {
351  std::string value;
352  is >> value;
353  if (is)
354  {
355  try
356  {
357  enumeration = Marker(value, false);
358  }
359  catch (const EnumerationException&)
360  {
361  is.setstate(std::ios::failbit);
362  }
363  }
364 
365  return is;
366  }
367 
368  }
369  }
370  }
371 }
372 
373 #endif // OME_XML_MODEL_ENUMS_MARKER_H
374 
375 /*
376  * Local Variables:
377  * mode:C++
378  * End:
379  */
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
Arrow.
Definition: Marker.h:79
EnumerationException is thrown when an enumeration is invalid or not found.
Definition: EnumerationException.h:74
static const value_map_type & values()
Get a map of valid enum values and string names.
Definition: Marker.cpp:141
enum_value
Enumeration values.
Definition: Marker.h:76
Marker enumeration.
Definition: Marker.h:72
std::map< std::string, Marker::enum_value > string_map_type
String map type.
Definition: Marker.h:149
static const string_map_type & strings()
Get a map of valid string names and enum values.
Definition: Marker.cpp:130
static const string_map_type & lowercase_strings()
Get a map of valid lowercased string names and enum values.
Definition: Marker.cpp:152
Open Microscopy Environment C++ implementation.
std::map< Marker::enum_value, std::string > value_map_type
Value map type.
Definition: Marker.h:151
Marker(enum_value value)
Construct a Marker enumeration by an enumeration value.
Definition: Marker.cpp:67
bool operator==(const AcquisitionMode &lhs, const AcquisitionMode &rhs)
Compare two AcquisitionMode objects for equality.
Definition: AcquisitionMode.h:236
enum_value value
Enumeration value.
Definition: Marker.h:179
const std::string * name
Enumeration name.
Definition: Marker.h:181
Marker & operator=(const Marker &rhs)
Assignment operator.
Definition: Marker.h:119