Alexandria  2.14.1
Please provide a description of the project.
GridAxis.icpp
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2012-2020 Euclid Science Ground Segment
3  *
4  * This library is free software; you can redistribute it and/or modify it under
5  * the terms of the GNU Lesser General Public License as published by the Free
6  * Software Foundation; either version 3.0 of the License, or (at your option)
7  * any later version.
8  *
9  * This library is distributed in the hope that it will be useful, but WITHOUT
10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
11  * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
12  * details.
13  *
14  * You should have received a copy of the GNU Lesser General Public License
15  * along with this library; if not, write to the Free Software Foundation, Inc.,
16  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
17  */
18 
19  /**
20  * @file GridContainer/_impl/GridAxis.icpp
21  * @date May 12, 2014
22  * @author Nikolaos Apostolakos
23  */
24 
25 #include <algorithm>
26 
27 namespace Euclid {
28 namespace GridContainer {
29 
30 template<typename T>
31 GridAxis<T>::GridAxis(std::string name, std::vector<T> values)
32  : m_name(std::move(name)), m_values(std::move(values)) {
33 }
34 
35 template<typename T>
36 size_t GridAxis<T>::size() const {
37  return m_values.size();
38 }
39 
40 template<typename T>
41 const std::string& GridAxis<T>::name() const {
42  return m_name;
43 }
44 
45 template<typename T>
46 const T& GridAxis<T>::operator[](size_t index) const {
47  return m_values[index];
48 }
49 
50 template<typename T>
51 auto GridAxis<T>::begin() const -> const_iterator {
52  return m_values.cbegin();
53 }
54 
55 template<typename T>
56 auto GridAxis<T>::end() const -> const_iterator {
57  return m_values.end();
58 }
59 
60 template<typename T>
61 template<typename U>
62 bool GridAxis<T>::operator==(const GridAxis<U>& other) const {
63  bool same = false;
64  if (this->size() == other.size()) {
65  same = std::equal(this->begin(), this->end(), other.begin());
66  }
67  return same;
68 }
69 
70 template<typename T>
71 template<typename U>
72 bool GridAxis<T>::operator!=(const GridAxis<U>& other) const {
73  return !this->operator==(other);
74 }
75 
76 } // end of namespace GridContainer
77 } // end of namespace Euclid