bioformats  5.1.8
Modulo.h
1 /*
2  * #%L
3  * OME-BIOFORMATS C++ library for image IO.
4  * Copyright © 2006 - 2016 Open Microscopy Environment:
5  * - Massachusetts Institute of Technology
6  * - National Institutes of Health
7  * - University of Dundee
8  * - Board of Regents of the University of Wisconsin-Madison
9  * - Glencoe Software, Inc.
10  * %%
11  * Redistribution and use in source and binary forms, with or without
12  * modification, are permitted provided that the following conditions are met:
13  *
14  * 1. Redistributions of source code must retain the above copyright notice,
15  * this list of conditions and the following disclaimer.
16  * 2. Redistributions in binary form must reproduce the above copyright notice,
17  * this list of conditions and the following disclaimer in the documentation
18  * and/or other materials provided with the distribution.
19  *
20  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
21  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
23  * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE
24  * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
25  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
26  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
27  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
28  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
29  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
30  * POSSIBILITY OF SUCH DAMAGE.
31  *
32  * The views and conclusions contained in the software and documentation are
33  * those of the authors and should not be interpreted as representing official
34  * policies, either expressed or implied, of any organization.
35  * #L%
36  */
37 
38 #ifndef OME_BIOFORMATS_MODULO_H
39 #define OME_BIOFORMATS_MODULO_H
40 
41 #include <string>
42 #include <vector>
43 #include <sstream>
44 
45 #include <ome/compat/cstdint.h>
46 
47 namespace ome
48 {
49  namespace bioformats
50  {
51 
57  class Modulo {
58  public:
60  typedef std::vector<std::string>::size_type size_type;
61 
63  std::string parentDimension;
65  double start;
67  double step;
69  double end;
71  std::string parentType;
73  std::string type;
75  std::string typeDescription;
77  std::string unit;
79  std::vector<std::string> labels;
80 
86  Modulo(std::string dimension);
87 
97  size_type
98  size() const;
99 
110  std::string
111  toXMLAnnotation() const;
112  };
113 
121  template<class charT, class traits>
122  inline std::basic_ostream<charT,traits>&
123  operator<< (std::basic_ostream<charT,traits>& os,
124  const Modulo& modulo)
125  {
126  os << "parentDimension = " << modulo.parentDimension << '\n'
127  << "start = " << modulo.start << '\n'
128  << "step = " << modulo.step << '\n'
129  << "end = " << modulo.end << '\n'
130  << "parentType = " << modulo.parentType << '\n'
131  << "type = " << modulo.type << '\n'
132  << "typeDescription = " << modulo.typeDescription << '\n'
133  << "unit = " << modulo.unit << '\n'
134  << "labels = ";
135  for (std::vector<std::string>::const_iterator i = modulo.labels.begin();
136  i != modulo.labels.end();
137  ++i)
138  {
139  os << *i;
140  if (i + 1 != modulo.labels.end())
141  os << ", ";
142  }
143  os << '\n';
144 
145  return os;
146  }
147 
148  }
149 }
150 
151 #endif // OME_BIOFORMATS_MODULO_H
152 
153 /*
154  * Local Variables:
155  * mode:C++
156  * End:
157  */
std::string parentType
Type of the parent dimension.
Definition: Modulo.h:71
A subdimension of Z, C, or T.
Definition: Modulo.h:57
std::string unit
Unit of the subdimension.
Definition: Modulo.h:77
double step
Step size.
Definition: Modulo.h:67
double end
End value.
Definition: Modulo.h:69
Modulo(std::string dimension)
Constructor.
Definition: Modulo.cpp:49
double start
Start value.
Definition: Modulo.h:65
size_type size() const
Get the size of this subdimension.
Definition: Modulo.cpp:63
Open Microscopy Environment C++ implementation.
Definition: CoreMetadata.cpp:40
std::string type
Type of the subdimension.
Definition: Modulo.h:73
std::string toXMLAnnotation() const
Convert to XML string.
Definition: Modulo.cpp:76
std::vector< std::string >::size_type size_type
Size of the subdimension.
Definition: Modulo.h:60
Standard integer types.
std::string parentDimension
Parent dimension being subdivided.
Definition: Modulo.h:63
std::vector< std::string > labels
Labels along the subdimension.
Definition: Modulo.h:79
std::string typeDescription
Type description of the subdimension.
Definition: Modulo.h:75