Alexandria 2.31.0
SDC-CH common library for the Euclid project
Loading...
Searching...
No Matches
XYDataset.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
26#ifndef XYDATASET_H_
27#define XYDATASET_H_
28
29#include <iterator>
30#include <memory>
31#include <string>
32#include <utility>
33#include <vector>
34
36
37namespace Euclid {
38namespace XYDataset {
39
60
61public:
63
76 XYDataset(std::vector<std::pair<double, double>> values) // cppcheck-suppress noExplicitConstructor
77 : m_values(std::move(values)){};
78
80 XYDataset(const XYDataset&) = default;
81
83 XYDataset(XYDataset&&) = default;
84
93 static XYDataset factory(std::vector<std::pair<double, double>> vector_pair);
94
105 static XYDataset factory(const std::vector<double>& x, const std::vector<double>& y);
106
110 virtual ~XYDataset() = default;
111
118 const_iterator begin() const;
119
126 const_iterator end() const;
127
134 const std::pair<double, double>& front() const;
135
142 const std::pair<double, double>& back() const;
143
150 size_t size() const {
151 return m_values.size();
152 }
153
154private:
156};
157
158} /* namespace XYDataset */
159} // end of namespace Euclid
160
161#endif // XYDATASET_H_
This module provides an interface for accessing two dimensional datasets (pairs of (X,...
Definition XYDataset.h:59
std::vector< std::pair< double, double > >::const_iterator const_iterator
Definition XYDataset.h:62
XYDataset(const XYDataset &)=default
Copy constructor.
size_t size() const
Get the size of the vector container.
Definition XYDataset.h:150
virtual ~XYDataset()=default
Destructor.
XYDataset(XYDataset &&)=default
Move constructor.
XYDataset(std::vector< std::pair< double, double > > values)
Constructor XYDataset interface represents an immutable data set.
Definition XYDataset.h:76
#define ELEMENTS_API
STL namespace.