Alexandria  2.19
Please provide a description of the project.
GridAxis.h
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 #ifndef GRIDCONTAINER_GRIDAXIS_H
26 #define GRIDCONTAINER_GRIDAXIS_H
27 
28 #include <string>
29 #include <vector>
30 
31 namespace Euclid {
32 namespace GridContainer {
33 
48 template <typename T>
49 class GridAxis {
50 
51 public:
53  typedef T data_type;
54 
57 
60 
62  virtual ~GridAxis() = default;
63 
65  size_t size() const;
66 
68  const std::string& name() const;
69 
71  const T& operator[](size_t index) const;
72 
75 
78 
91  template <typename U>
92  bool operator==(const GridAxis<U>& other) const;
93 
95  template <typename U>
96  bool operator!=(const GridAxis<U>& other) const;
97 
98 private:
101 };
102 
103 } // end of namespace GridContainer
104 } // end of namespace Euclid
105 
107 
108 #endif /* GRIDCONTAINER_GRIDAXIS_H */
Provides information related with an axis of a GridContainer.
Definition: GridAxis.h:49
const_iterator begin() const
Returns an iterator at the first knot of the axis.
std::vector< T >::const_iterator const_iterator
The iterator type of the GridAxis.
Definition: GridAxis.h:56
GridAxis(std::string name, std::vector< T > values)
Constructs an GridAxis with the given name and knot values.
std::vector< T > m_values
Definition: GridAxis.h:100
const std::string & name() const
Returns the name of the axis.
size_t size() const
Returns the number of knots of the axis.
const T & operator[](size_t index) const
Returns the value of the knot with the given index.
virtual ~GridAxis()=default
Default destructor.
T data_type
The type of the axis values.
Definition: GridAxis.h:53
bool operator==(const GridAxis< U > &other) const
Compares the axis with another axis.
bool operator!=(const GridAxis< U > &other) const
The opposite of the == operator.
const_iterator end() const
Returns an iterator after the last knot of the axis.