Alexandria 2.31.0
SDC-CH common library for the Euclid project
Loading...
Searching...
No Matches
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
31namespace Euclid {
32namespace GridContainer {
33
48template <typename T>
49class GridAxis {
50
51public:
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
81 const_iterator infimum(const T& value) const;
82
95 template <typename U>
96 bool operator==(const GridAxis<U>& other) const;
97
99 template <typename U>
100 bool operator!=(const GridAxis<U>& other) const;
101
102private:
105};
106
107} // end of namespace GridContainer
108} // end of namespace Euclid
109
111
112#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.
const_iterator infimum(const T &value) const
size_t size() const
Returns the number of knots of the axis.
virtual ~GridAxis()=default
Default destructor.
const std::string & name() const
Returns the name of the axis.
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.
const T & operator[](size_t index) const
Returns the value of the knot with the given index.