Zivid  1.0.1+3607.8a7510c4
Zivid API
Range.h
Go to the documentation of this file.
1 /*[
2  * This file is part of the Zivid 3D Camera API
3  *
4  * Copyright 2015-2018 (C) Zivid Labs. All rights reserved.
5  * Contact info@zividlabs.com or see http://www.zividlabs.com
6  *
7  * This code is proprietary and confidential.
8  * Unauthorized copying of this file, via any medium is strictly prohibited.
9 ]*/
10 
11 #pragma once
12 
15 
16 #include <sstream>
17 
18 namespace Zivid {
19 
24  template <typename T> class Range {
25  public:
27  Range(const T &min, const T &max) : m_min{ min }, m_max{ max } {}
28 
30  const T &min() const { return m_min; }
31 
33  const T &max() const { return m_max; }
34 
36  std::string toString() const
37  {
38  std::stringstream stream;
39  stream << "Range{ " << m_min << ", " << m_max << " }";
40  return stream.str();
41  }
42 
43  private:
44  T m_min;
45  T m_max;
46  };
47 
49  template <typename T>
50  std::ostream& operator<<(std::ostream& os, const Range<T> &range)
51  {
52  return os << range.toString();
53  }
54 } // namespace Zivid
Class describing a range of values for a given type T The range boudaries for both minimum and maximu...
Definition: Range.h:24
Definition: Application.h:19
const T & max() const
Get the maximum value of the range
Definition: Range.h:33
const T & min() const
Get the minimum value of the range
Definition: Range.h:30
Range(const T &min, const T &max)
Constructor
Definition: Range.h:27
std::string toString() const
Get the range as string
Definition: Range.h:36