Alexandria  2.18
Please provide a description of the project.
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
GridAxis.icpp
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2012-2021 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 
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) : m_name(std::move(name_)), m_values(std::move(values)) {}
32 
33 template <typename T>
34 size_t GridAxis<T>::size() const {
35  return m_values.size();
36 }
37 
38 template <typename T>
40  return m_name;
41 }
42 
43 template <typename T>
44 const T& GridAxis<T>::operator[](size_t index) const {
45  return m_values[index];
46 }
47 
48 template <typename T>
50  return m_values.cbegin();
51 }
52 
53 template <typename T>
55  return m_values.end();
56 }
57 
58 template <typename T>
59 template <typename U>
60 bool GridAxis<T>::operator==(const GridAxis<U>& other) const {
61  bool same = false;
62  if (this->size() == other.size()) {
63  same = std::equal(this->begin(), this->end(), other.begin());
64  }
65  return same;
66 }
67 
68 template <typename T>
69 template <typename U>
70 bool GridAxis<T>::operator!=(const GridAxis<U>& other) const {
71  return !this->operator==(other);
72 }
73 
74 } // end of namespace GridContainer
75 } // end of namespace Euclid
bool operator!=(const GridAxis< U > &other) const
The opposite of the == operator.
Definition: GridAxis.icpp:70
STL class.
bool operator==(const GridAxis< U > &other) const
Compares the axis with another axis.
Definition: GridAxis.icpp:60
Provides information related with an axis of a GridContainer.
Definition: GridAxis.h:49
const_iterator end() const
Returns an iterator after the last knot of the axis.
Definition: GridAxis.icpp:54
STL class.
const std::string & name() const
Returns the name of the axis.
Definition: GridAxis.icpp:39
GridAxis(std::string name, std::vector< T > values)
Constructs an GridAxis with the given name and knot values.
Definition: GridAxis.icpp:31
const_iterator begin() const
Returns an iterator at the first knot of the axis.
Definition: GridAxis.icpp:49
size_t size() const
Returns the number of knots of the axis.
Definition: GridAxis.icpp:34
const T & operator[](size_t index) const
Returns the value of the knot with the given index.
Definition: GridAxis.icpp:44
std::vector< T >::const_iterator const_iterator
The iterator type of the GridAxis.
Definition: GridAxis.h:56
T equal(T...args)